Results 1 to 5 of 5
Thread: Select form in PHP/MYSQL
-
03-14-2003, 11:11 AM #1Web Hosting Master
- Join Date
- Dec 2002
- Location
- UK
- Posts
- 838
Select form in PHP/MYSQL
Hello all
quick question
just doing a form which conisists of a drop down menu..of Cities in UK
what i basically wanna do is that on the Database there is a field called Cities which displays all the cities...... a user selects a city press submits and it goes to see in the database whether there is any city..in the DB
here is the snippet of the code of the form
PHP Code:<form name="form1" method="post" action="citysearch.php">
<select name=citysearch size=\"1\" id="citysearch">
<option value=\"none\" selected>Select One</option>
<option value=\"Aberdeen\">Aberdeen</option>
<option value=\"Accrington\">Accrington</option>
<option value=\"Aylesbury\">Aylesbury</option>
<option value=\"Banbury\">Banbury</option>
<option value=\"Bangor\">Bangor</option>
<option value=\"Worthing\">Worthing</option>
<option value=\"Wrexham\">Wrexham</option>
<option value=\"Yeovil\">Yeovil</option>
<option value=\"York\">York</option>
</select>
<input type="submit" name="Submit" value="Search">
</form>
to sum it up...user come on the site..does a drop down search for the city...press submits and its then it check the DB to see if that City exists
cud anyone help me with this please how wud i do this
thanks
bye for now
-
03-14-2003, 11:15 AM #2Junior Guru Wannabe
- Join Date
- May 2002
- Location
- Alkmaar, Netherlands
- Posts
- 78
why dont you populate select box from cities in your database? so they can only search from cities available in your database instead of seeing "city is not in our database" message
Gokhan Arli
Web Developer(RubyOnRails/MySQL/.NET)
www.sylow.net
-
03-14-2003, 11:19 AM #3Web Hosting Master
- Join Date
- Dec 2002
- Location
- UK
- Posts
- 838
oh rite
do u mean something like a user just types in the City..on a search box as opposed to having a drop down menu.....?
is that what u mean?
thanks
bye for now
-
03-14-2003, 12:57 PM #4WHT Addict
- Join Date
- Feb 2002
- Location
- uk
- Posts
- 110
or you can create a dropdown menu with only the cities contained in your db.
-
03-14-2003, 06:31 PM #5Disabled
- Join Date
- Mar 2003
- Location
- PHP =)
- Posts
- 110
yah
just use a while statement and echo each option