PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Wed Aug 22, 2018 3:14 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Muliple Select Boxes
PostPosted: Mon Oct 06, 2008 6:36 pm 
Offline
Forum Contributor

Joined: Sat May 31, 2008 3:27 pm
Posts: 192
~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?

Syntax: [ Download ] [ Hide ]
<?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.


Top
 Profile  
 
 Post subject: Re: Muliple Select Boxes
PostPosted: Thu Oct 09, 2008 12:51 pm 
Offline
Forum Contributor

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


Top
 Profile  
 
 Post subject: Re: Muliple Select Boxes
PostPosted: Mon Oct 13, 2008 6:03 pm 
Offline
Forum Contributor

Joined: Sat May 31, 2008 3:27 pm
Posts: 192
Any help?


Top
 Profile  
 
 Post subject: Re: Muliple Select Boxes
PostPosted: Tue Oct 14, 2008 9:59 am 
Offline
Briney Mod
User avatar

Joined: Mon Jan 19, 2004 7:11 pm
Posts: 6445
Location: 53.01N x 112.48W
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group