Muliple Select Boxes

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
CoolAsCarlito
Forum Contributor
Posts: 192
Joined: Sat May 31, 2008 3:27 pm
Contact:

Muliple Select Boxes

Post by CoolAsCarlito »

~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: :arrow: 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: :arrow: Posting Code in the Forums to learn how to do it too.
CoolAsCarlito
Forum Contributor
Posts: 192
Joined: Sat May 31, 2008 3:27 pm
Contact:

Re: Muliple Select Boxes

Post by CoolAsCarlito »

Anyone have any support for me?
CoolAsCarlito
Forum Contributor
Posts: 192
Joined: Sat May 31, 2008 3:27 pm
Contact:

Re: Muliple Select Boxes

Post by CoolAsCarlito »

Any help?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Muliple Select Boxes

Post by pickle »

What you're looking for is "chained selects". Do a search for that here and on Google & you should find some tips.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply