View Full Version : session array

04-18-2012, 07:41 PM
<form method="post" action="ecc.php">
<table bgcolor="#FFCC00" width="40" border="2" cellspacing="10">
<tr><td colspan="20"><input type="radio" name="type" value="1000" />1000 point </tr>
<tr><td colspan="20"><input type="radio" name="type" value="500" />500 point </tr>
<tr><td colspan="2" align="center"><input type="submit" name="submit" id="submit" />


if (isset($_POST['Submit'])) {
$_SESSION['a'][0] = $_POST['type'];
if($_SESSION['a'][0]== 1000)
{ $b==1000;}
{ $b==500;}
echo"the no is ".$b;


please check it that it is right. I want to save the value of radio button in a variable so that I may use it in further calculation.

04-18-2012, 07:57 PM
associative offsets are case sensitive. There is also no guarantee that submit will be provided in IE as it doesn't conform to the w3 successful fields for forms.
Use if (isset($_POST['type'])) as your comparison.