Sessions and Forms
Posted: Sun Mar 28, 2004 2:21 pm
The following is my code to use a form field to insert a value into to Session variable. However, I can't get the session variable to be updated when the form action is made. Yes I am a newbie!
Code: Select all
<?php
session_start();
session_register('session_var');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Testing Sessions page 1</title>
</head>
<body>
<?php
if($form_var) {
$session_var = $form_var;
}
?>
<form action="sessionTest2.php" method="post">
<input name="form_var" type="text" value="testing">
<input name="" type="submit" value="Go to Next Page">
</form>
</body>
</html>