For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > December 2004 > Re: [SMARTY] redirection









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [SMARTY] redirection
On.Kg

2004-12-02, 4:08 pm

You can make Form itself and POST validation by one script

For example, login.php
=================
<?php
if($_POST) {
$error = '';
// form validation
...

// if there's no error...
if(empty($error)) {
header("Location: loged.php");
exit;
} else {
$smarty->assign('error', $error);
}
}

$smarty->display('login_form.tpl')
?>
=================


login_form.tpl
=================
{* Login form *}

{if $error}<b class=error>{$error}</b>{/if}

<form action="{$smarty.server.PHP_SELF}" method="post">
.....
</form>
=================

;)


EB> I have a basic question about redirection, and assigning values.

EB> In a nutshell, I want my login procedure to redirect back to the login page
EB> if there was an error, but I also want to assign a message to the form.
EB> Obviously, the message assignment gets wiped out.

EB> How do I deal with?


EB> Best regards,

EB> Erich Beyrent
EB> Systems Administrator
EB> Information Technology Services
EB> Plymouth State University
EB> (603) 535-2948
EB> ecbeyrent@plymouth.edu

EB> "Si vis pacem para bellum"
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com