A
Anonymous
Guest
Please have a carefull look of my code. I am trying to differentiate the items after the final submission so that I have all items for each submission togather and those item must be identified whether it comes from top menu or the bottom menu. Please let me know if you have some idea how to do that. Thank you.
Code:
<html>
<title>
Menu test
</title>
<body>
<script type="text/javascript">
</script>
<pre>
<?php
extract( $_GET );
if( !isset($submit))// do this if no GET vars
{
print "<form method=\"GET\">";
print "<p>Enter in the number of times below:</p>";
print "<input type=\"text\" name=\"number\" size=\"30\">";
$menu_counter = 0;
print "<input type='hidden' name='menu_counter' value=$menu_counter>";
print "<input name=\"submit\" type=\"submit\" value=\"send\">";
print "<input name=\"reset\" type=\"reset\" value=\"reset\">";
print "</form>" ;
}
else
{
if( $submit=='submit' )
{
$results[] = $currentSelections;
}
if( $number>0 )
{
$months = array("January","February","March","April","May","June","July", "August","September","October","November","December");
$number = $HTTP_GET_VARS["number"]-1;
$menu_counter =$HTTP_GET_VARS["menu_counter"]+1;
print "<form method=\"GET\">";
print "Select components for term $menu_counter<br>";
?>
<select size="5" name="user_choice[]" onclick="updateTextBox(this, currentSelections)">
<?php
foreach ($months as $Existing_Item)
{
print "<option value=\"$Existing_Item \">$Existing_Item</option>";
}
print "</select>";
print "<br>";
?>
<select size="5" name="user_choice[]" onclick="updateTextBox(this, currentSelections)">
<?php
foreach ($months as $Existing_Item)
{
print "<option value=\"$Existing_Item \">$Existing_Item</option>";
}
print "</select>";
print "<br>";
?>
<textarea name = 'currentSelections' readonly="readonly" rows = "3" cols = "20"></textarea>
<br>
<?php
print "<input type='hidden' name='number' value=$number>";
print "<input type='hidden' name='menu_counter' value=$menu_counter>";
print "<input name=\"submit\" type=\"submit\" value=\"submit\">";
print "<input name=\"reset\" type=\"reset\" value=\"reset\">";
$i=0;
if( isarray( $results ) )
foreach( $results as $res )
{
echo "<input type='hidden' name='results[$i]' value='$res'>";
$i++;
}
print "</form>";
}
else
{
print "<br>You choice are: <br>";
$Selected_Array = $results;
foreach($Selected_Array as $name)
{
print "$name<BR>";
}
}
}
?>
</body>
</html>