SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist
    Join Date
    Jan 2005
    Location
    ireland
    Posts
    482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Dropdowns Help

    Hi

    I really need some guidance, My basic problem is

    I have two dropdown lists on a page.

    When I select an option in dropdown one

    the values in drop down two will depend on what option is selected dropdown

    one Is it possible to do this without having a button to press next to

    dropdown one, i mean when dropdown one is selected the $_POST variable

    will pass to Dropdown Two. Will I have to use javascript, don't know any

    javascript so trying to avoid this method.

    help me

    Very frustrated.

    Tks in advance



    Example


    // DROP DOWN ONE


    echo'<tr>
    <td colspan="2" class="labelcell"><label for="secondary_exam_id">

    Select Exam/label></td>';

    echo'<td colspan="2" class="fieldcell2"> <select name="secondary_exam_id">';

    $query_result = mysql_query ('SELECT * FROM secondary_exam_type ORDER BY secondary_exam_id');

    while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))

    {
    echo "<option value=\"$row[0]\">$row[1]</option>\n";
    }

    echo'</select></td>';

    echo'</tr>';


    // DROP DOWN TWO



    echo'<tr>
    <td colspan="2" class="labelcell"><label for="junior_subject_id">

    Select Subject/label></td>';

    echo'<td colspan="2" class="fieldcell2"><select name="junior_subject_id">';


    $query_result = mysql_query ('SELECT * FROM junior_subjects ORDER BY junior_subject_id');

    while ($row = mysql_fetch_array ($query_result, MYSQL_NUM))

    {
    echo "<option value=\"$row[0]\">$row[1]</option>\n";
    }

    echo'</select></td>';

    echo'</tr>';

    Tks in advance

    Gaz

  2. #2
    SitePoint Member
    Join Date
    Nov 2004
    Location
    Philippines
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy

    Hello gokeeffe,

    We have a similar problem, i found the solution but this is a javascript edition here's the link http://www.dynamicdrive.com/dynamici...ects/index.htm.

    to anyone outher is't possible to use PHP for this problem?.....

  3. #3
    SitePoint Guru ujjwal's Avatar
    Join Date
    Oct 2004
    Location
    kolkata
    Posts
    821
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by gokeeffe
    Hi

    I really need some guidance, My basic problem is

    I have two dropdown lists on a page.

    When I select an option in dropdown one

    the values in drop down two will depend on what option is selected dropdown

    one Is it possible to do this without having a button to press next to

    dropdown one, i mean when dropdown one is selected the $_POST variable

    will pass to Dropdown Two. Will I have to use javascript, don't know any

    javascript so trying to avoid this method.

    help me

    Very frustrated.

    Tks in advance
    yes ,this can be possible in PHP.
    Try out in here.using php and iframe
    click

  4. #4
    SitePoint Wizard edshuck's Avatar
    Join Date
    Jul 2000
    Posts
    1,200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have it working but not pretty on www.noevalley.com

    I will share the whole thing with this forum if you like. Take a look in the upper right of the page and try it a bit. Some do not work but that is a populating problem.


Bookmarks

Posting Permissions

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