First off you need to place all form fields inside the form itself. And all form data will be available from the $_POST array not inside the $_SESSION array.
I have modified your example to display the first group of radio buttons with a loop inside the form. You should only have to modify it slightly to get it to work with select boxes. Hope this helps you get started.
PHP Code:
<?php
// if there was information submitted then process it.
if( isset( $_POST ) && !empty( $_POST ) )
{
// process $_POST data
echo 'Contents of $_POST array:';
echo '<pre>' . print_r( $_POST, 1 ) . '</pre>';
}
$ticket_quality = array(
'Best' => 'Give me the best seats you have got - $110.00',
'Not_lame' => 'Give me some seats that wont make me feel lame - $75.00',
'Desperate' => 'Ill take any solid slab I can park my butt on. Or, Ill stand - $25.00',
);
$nice_amenities = array(
'Drink' => 'Medium Fountain Drink - $1.50',
'Side' => 'One Delicious Side of Fries or Onion Rings - $1.50',
'Pin' => 'A Tiny but Cool Pin with which to Show My Fan Loyalty - $1.50',
'Sticker' => 'A Sticker Suitable for a 3-Ring Binder or the Top of a Laptop - $1.50',
'Earplugs' => 'Designer Earplugs - $1.50'
);
$best_amenities = array(
'Combo' => 'One of those Combo Things Where you Get a Sandwich, Fries, and a Drink - $7.00',
'Cd' => 'A CD of the Concert, Available within Seconds of the Concerts Ending - $7.00',
'Frisbee' => 'A Frisbee with a Hallucinogenic Design Only Visible from a Helicopter - $7.00',
'Shirt' => 'A T-Shirt that Looks Suspiciously Worn - $7.00',
'Picture' => 'A Shot of Me Screaming in Slow Motion on the Jumbotron - $7.00'
);
?>
<html>
<head>
<title>Final Form</title>
</head>
<body>
<div id="wrapper">
<div id="container">
<div id="content">
<div id="masthead">
Masthead
</div>
<form action="" method="POST">
<h2>I have tickets of a certain quality</h2>
<p>
<?php
// create a loop to cycle through all ticket quality items
foreach( $ticket_quality as $key => $value )
{
echo "<input type='radio' name=ticket_quality'
value='{$key}'> {$value} </input><br />";
}
?>
</p>
<h2>I Want To Tell You Who I Am and Where I Live</h2>
<table>
<tr>
<td><label for="full_name">Full Name</label></td>
<td><input type="text" name="full_name" size=30></td>
</tr>
<tr>
<td><label for="street_address">Street Address</label></td>
<td><input type="text" name="street_address" size=30></td>
</tr>
<tr>
<td><label for="zip_code">Zip Code</label></td>
<td><input type="text" name="zip_code" size=30></td>
</tr>
<tr>
<td><label for="email_address">Email Address</label></td>
<td><input type="text" name="email_address" id="email_address" size="30"></td>
</tr>
<tr>
<td><label for="phone">Phone</label></td>
<td><input type="text" name="phone" size=30></td>
</tr>
<tr>
<td><input type="submit" value="continue"></td>
<td></td>
</tr>
</table>
</form>
</div>
</div>
</div>
</body>
</html>
Bookmarks