|
Posted by Vincent Delporte on 12/11/06 20:45
On Mon, 11 Dec 2006 21:36:16 +0100, Vincent Delporte
<justask@acme.com> wrote:
>Yup, looks like that's the solution. Thanks guys for the great help.
So here's what it looks like:
-------------
<?php
//very first connection?
if(!isset($HTTP_COOKIE_VARS["PHPSESSID"])){
//Already shown form or not?
if ( $_SERVER['REQUEST_METHOD']=='GET' ) {
?>
<form action=<?php echo $PHP_SELF; ?> method=POST>
<input type=submit name=mybutton value="Click
me!">
</form>
<?php
} else {
session_start();
//here, handle form
header("Location: " . $PHP_SELF);
}
} else {
print "Form has been shown and handled, and sessionID created:
done!";
}
?>
-------------
Next, I'll take a look at the different templating systems (CakePHP,
Savant, Smarty, etc.) to separate logic and display.
Thanks.
Navigation:
[Reply to this message]
|