Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.


Results 1 to 3 of 3

Thread: PHP Form w/ multiple select options loaded from mysql database

  1. #1

    PHP Form w/ multiple select options loaded from mysql database

    Hey there
    Just wanted to know if someone could help me out here:

    A PHP form that enables people to submit an email form. The email form also has a multiple select list.

    Now here's the catch. The multiple select options have to be loaded from a mysql database?

    So I'm assuming there'll be some sort of 'loop' function here too <option value="">Option Value here</option> ?

    Can someone point me to a script that enables me to do this?


  2. #2
    First of all you need to query the database for the results, ie the options you want to display
    Then you need to disply the results in a while loop, then close the query, like this
    $query = mysql_query("SELECT * FROM blah")
    echo "<select name='blah_blah'>";
    while ($row=mysql_fetch_array($query)) {
    echo "<option>". $row['options']."</option>";
    echo "</select>";
    Like that but you have to replace the variable with what you need, kinda easy really but only if you've been told like I was.

  3. #3

    Any luck?

    Have you had any luck resolving your problem yet? If so, could you please let me know what you're findings were becauase I am having a similar problem.

    -- Dan

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About kirupa.com Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012