Hi,
I'm creating a selection form with array data, using a for loop. This is my first time doing this, so it could be a pretty dumb mistake, but all the values end up printing on the line above the selection box, and the selection box comes up empty. Here's the code I'm using:
Thanks for your help!
I'm creating a selection form with array data, using a for loop. This is my first time doing this, so it could be a pretty dumb mistake, but all the values end up printing on the line above the selection box, and the selection box comes up empty. Here's the code I'm using:
Code:
<?php
/* Builds the selection list array */
$Distances = array("50","100","200","400","500","800","1000","1500","1650");
echo "<form action = 'FormPrepared.php' method = 'POST'><table border='0' width='50%'>";
echo "<tr><td>Distance</td><td><select name='SelectedDistance'></td></tr>";
$Counter = 0;
for ($i=0;$i<sizeof($Distances);$i++)
{
echo "<option value = 'Distances[$i]'";
if ($Counter == 0)
{
echo "selected";
}
echo "> $Distances[$i] </option> \n";
$Counter++;
}
echo "</select>\n";
Comment