Last I checked, session_start() needs to be called before anything is output, or you'll have errors. Basically you should be doing script work before putting any text or HTML on the page. This takes a little getting used to when coming from HTML coding, which has no separation of logic and display.
PHP Code:
<?php
session_start();
// For all the variables you're using, not just one. This will help keep errors down.
if (isset($_POST['submit'], $_POST['type']))
{
$type = $_POST['type'];
$_SESSION['a'][0] = (int)$type;
if($_SESSION['a'][0] == 1000)
$b = 1000;
else
$b = 500;
?>
<form method="post" action="point.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" />
</table>
</form>
<?php
echo 'The number is ', $b;
?>
Bookmarks