I read the other topic on here recently about PHP sessions. So I decided to have a crack at setting them up myself for a small project I'm working on. However I'm having trouble with my code
The following code does exactly what I want it to, but I need to click submit twice for the effects to be shown.
PHP Code:
<?php session_start(); ?>
<form method="post" action="example2.php">
<input type="text" name="bla" value="<?php echo $bla; ?>" />
<input type="hidden" name="action" value="update" />
<input type="submit" name="Submit" /></p>
</form>
<h1><?php echo $bla; ?></h1>
<?php
foreach ($_POST as $key=>$value)
{$_SESSION[$key] = $value;}
?>
Do any of you know what I'm doing wrong?