Help in passing multiple HTML form options to SQL query <-- Newbie

From: Date: Sat, 27 Oct 2001 21:49:01 +0000
Subject: Help in passing multiple HTML form options to SQL query <-- Newbie
Groups: php.db 
Request: Send a blank email to php-db+get-13775@lists.php.net to get a copy of this message
I am designing a ski web site and am presently trying to put together a resort database. I started the search script tonight and am quite pleased that it works. Where I am struggling is that I would like my visitors to be able to select multiple countries from the drop down list and for my query to pull back info on all those selected. When I try it it only pulls back the last one (naturally). Please advise on what would be the most efficient way of constructing the query. Please talk in easy speak as I am real new at this and am not a developer by any stretch of the imagination. Many Thanks Torrent Here is a cut down version of my code, the html form is at the bottom. <?php if ($search) { $sql = "SELECT rst_name, cty_name FROM resort_tbl WHERE cty_name='$country'"; $result = mysql_query($sql); if ($row = mysql_fetch_array($result)) { echo "<center><table border=1>\n"; echo "<tr><td>Name</td><td>Country</td></tr>\n"; do { printf("<tr><td>%s</td><td>%s</td>\n", $row["rst_name"], $row["cty_name"]); } while ($myrow = mysql_fetch_array($result)); echo "</table></center>\n"; } } ?> <form name="resort" method="post" action="<?php echo $PHP_SELF?>"> <p> Select country </font><br> <select name="Country" size="5" multiple> <option value="Andorra">Andorra</option> <option value="Austria">Austria</option> <option value="Bulgaria">Bulgaria</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="Italy">Italy</option> <option value="North America">North America</option> <option value="Norway">Norway</option> <option value="Romania">Romania</option> <option value="Slovenia">Slovenia</option> <option value="Spain">Spain</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> </select> <br> <input type="submit" name="search" value="Search"> </p> </form>

« previous php.db (#13775) next »