Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Updating a mysql record, php

Options
  • 11-02-2009 8:39pm
    #1
    Closed Accounts Posts: 73 ✭✭


    question about list boxes and updating record.

    I click a link, to bring me to (update page)the required record, then in the update page i make changes (regarding the list box, can i have the selections highlighted in the list box, so i can see which are already tied to the record)


Comments

  • Registered Users Posts: 26,579 ✭✭✭✭Creamy Goodness


    read the values from the database into php variables.

    if the variables are not empty then set selected of the check box to be equal to selected.

    pseudocode

    selected:="selected =\"selected\""

    IF $somevar IS NOT NULL
    print "<input type=\"checkbox\" $selected name=\"whatever\" id=\"whatever\" />"
    ELSE
    //do something else.

    this may not be what you wanted but from such little information this is what i gathered.


  • Closed Accounts Posts: 73 ✭✭Protype


    This is the list box code. Do you have any idea how i could get this to run as a loop

    <option value="<?php echo $row_rsCovered?>"

    <?php if (!(strcmp($row_rsCovered, $row_EditCovered)))
    {
    echo "selected=\"selected\"";
    }
    ?>>
    <?php echo $row_rsCovered?></option>


  • Closed Accounts Posts: 73 ✭✭Protype


    When updating i will need to have all selections in the box and not just one. the code above gives me one. i think i need the above code to run as a loop so that it will select all the info in relation to the record in the database

    DON'T forget this is for an update page


Advertisement