SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict D3V4's Avatar
    Join Date
    May 2010
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Update a table from a form

    I have a <table> that contains all the information from a database, and I want the user to update this information through a form. Every row of the table has an "Edit" button, which is a link that takes the user to a page where there's a form letting them update the information of the selected row.

    My problem is, how can I connect the Edit button with the correct row? in other words, how can I store the information about which row has been selected, in order to update the selected row?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Put the key that identifies the data in the query string of the link of each button.

  3. #3
    SitePoint Addict D3V4's Avatar
    Join Date
    May 2010
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Put the key that identifies the data in the query string of the link of each button.
    Thanks!

  4. #4
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,500
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Using $_GET['variable']

    http://www.php.net/manual/en/reserved.variables.get.php

    Don't forget to sanitize the value before using it in the query.

  5. #5
    SitePoint Addict D3V4's Avatar
    Join Date
    May 2010
    Posts
    370
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Using $_GET['variable']

    http://www.php.net/manual/en/reserved.variables.get.php

    Don't forget to sanitize the value before using it in the query.
    Thanks for the reply, I had found an answer already


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
  •