Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2006
    Posts
    4

    Unanswered: Update from form

    I want to be able to show three fields from my mysql database and update one. I have a id,Username,email address, and paid field. Now i want to be able to show all the data and then update only the paid field for each record???

    \much help needed, do you have an example?

    thanks pete

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    Just echo out the variables that are read-only. Create a form with the id field as a hidden input and then the paid field as a checkbox(?) input. Now when you submit the form, you'll know the id and the value of paid.

  3. #3
    Join Date
    Mar 2006
    Posts
    4

    hello

    could i possibly hav e an exAMPLE?

    THANKS

  4. #4
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    PHP Code:
    <form action="some_page.php" method="post">
    <input type="hidden" name="id" value="<?php echo $idValue?>" />
    <table>
       <tr>
          <td>
             <?php echo $username ?>
          </td>
          <td>
             <?php echo $email ?>
          </td>
          <td>
             <input type="checkbox" name="paid" value="1" />
          </td>
          <td>
             <input type="submit" />
          </td>
       </tr>
    </table>
    </form>
    On your form processing page, just use $_POST[] to get the fields and create your sql statement.

Posting Permissions

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