Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Listbox Select Question

    Below is the code i am using to populate a listbox.

    PHP Code:
    echo('<select name"course">');
    while(
    $row mysql_fetch_array($resultMYSQL_ASSOC)){
    echo 
    "<option>".$row['course_name']."</option>";
    }
    echo(
    '</select><br /><input type="submit" value="go" /></form>'); 
    The table scheme is:
    course_id int not null auto_increment
    course_name char(150) not null

    Is there a way with php to reference the course_id?

    I can do
    PHP Code:
    $course_name $_POST['course'
    just fine but cant figure out howto pull course_id out.

  • #2
    New Coder
    Join Date
    Mar 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    opps.. figured it out..

    PHP Code:
    <option value="'.$row['course_id']'"


  •  

    Posting Permissions

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