Muliple Select Boxes
Posted: Mon Oct 06, 2008 6:36 pm
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
One a user selects an option out of the first select box I want it to take that type back to the database and match it with all the show names with that type and then place all show names in that second select box. How is this done? And is my coding right so far?
~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:
Posting Code in the Forums to learn how to do it too.
One a user selects an option out of the first select box I want it to take that type back to the database and match it with all the show names with that type and then place all show names in that second select box. How is this done? And is my coding right so far?
Code: Select all
<?php
/* setupshow.php */
/* This form after submission takes the results of the form and makes a new show ready for adding matches. */
require ('database.php');
echo '<form action="setupshow.php" method="post">';
echo '<fieldset>';
echo '<legend>Enter the following information to setup a show:</legend>';
echo '<p>Weekly Show or Pay-Per View:<select name="type"><option value="">Select a Show Type</option>';
$query = 'SELECT type FROM shows';
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)){
echo "<option value=\"{$row['type']}\">{$row['type']}</option>\r";
}
echo '</select></p>';
echo '<p>Show Name:<select name="showname"><option value="">Select a Show Name</option>';
$query2 = 'SELECT showname FROM shows';
$result2 = mysql_query($query2);
while ($row = mysql_fetch_assoc($result)){
echo "<option value=\"{$row['showname']}\">{$row['showname']}</option>\r";
}
echo '</select></p>';
echo '<p>Show Label:<input name="showlabel" type="text" readonly="true" size="5"></p>';
echo '<p>Location:<input name="location" type="text"></p>';
echo '<p>Arena:<input name="arena" type="text"></p>';
echo '<div align="center"><input name="submit" type="submit"><input name="sumbitted" type="hidden" value="TRUE"></div>';
echo '</fieldset>';
echo '</form>';
?>~pickle | Please use [ code=html ], [ code=php ], etc tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: