Re: [SMARTY] redirection
| From: | ON.KG | Date: | Thu, 02 Dec 2004 21:10:24 +0000 |
| Subject: | Re: [SMARTY] redirection | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12011@lists.php.net to get a copy of this message | ||
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"