SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    combo box... help me

    Programmers out there ..help me please ....

    here is the story..
    i'm taking out some data from mysql database into a combo box so that user can select which data they want to edit.

    the problem here is as i am using the while loop to load the data into the combo box the value for the variable is the value of the last item loaded.

    here is the codes:

    $query2=mysql_query("select * from suggestion");

    <form method='post' action='evaluate.php'>
    select suggestion to evaluate : <select name='feasibility'>";
    while ($r=MYSQL_FETCH_ARRAY($query2))
    {
    $sid=$r['id'];
    $date=$r['date'];
    $coordinator=$r['coordinator_id'];

    echo"<option value='$sid'>Keyed in by $coordinator At $date</option>";
    }

    echo"</select><BR>
    <input type='submit' name='submit' value='submit !!'><br><BR>
    </form>

    the problem is the $sid variable is holding the id of the las item loaded.
    so... somebody please help me..
    please whow me if there is another way to do this. cry.gif cry.gif cry.gif


    --------------------
    shogan

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2004
    Posts
    1,647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $query2 mysql_query("SELECT * FROM suggestion ORDER BY id");
    echo 
    "<form method='post' action='evaluate.php'>
    select suggestion to evaluate : <select name='feasibility'>"
    ;
    while (
    $r=MYSQL_FETCH_ARRAY($query2)) {
    $sid=$r['id'];
    $date=$r['date'];
    $coordinator=$r['coordinator_id'];
    echo 
    "<option value='$sid'>Keyed in by $coordinator At $date</option>";
    }
    echo 
    "</select><br><input type='submit' name='submit' value='submit!!'><br><br>
    </form>"

    cheers

  3. #3
    SitePoint Member
    Join Date
    Feb 2005
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i think u don't understand my problem ...
    the data is viewable to the user.. but the thing is.. i want to modified the data..
    i want to make it to be something like phpMyAdmin.. where we juz can check on the checkbox to edit any data dat we like

    my problem is to maintain the value hold by the $sid variable. because after while loop it will hold the value of the last loaded item


    but thanx anyway


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
  •