editing items via a button listed in the while statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whitep8
    New Member
    • Oct 2009
    • 65

    #1

    editing items via a button listed in the while statement

    Hi All,

    My problem is this......

    I have looped through a query to find all items related to a paticular user id.

    Those items are echo'd to the page, and within that ive added an href to "edit.php" where ill display a form holding the held data.

    How do i get that items id passed to that page for editing?

    If i did something like header:location edit.php?id=$ro w['id'] would that allow me to use a "get" to grab it from the url?

    below is a snippet

    Code:
    $results = mysql_query($query);
    echo "<table>";
    echo "<tr><td>" . "Your propery listing(s) are as follows" . "</td></tr>";
    echo "<tr><td>" . "</td></tr>";
    echo "<tr><td>" . "Address Line 1" . "</td>" . "<td>" . "Post / Zip Code" . "</td>" . "<td>" .   "Property Value" . "</td></tr>";
    while($row = mysql_fetch_array($results))
     {
    	
    echo "<tr><td>" . $row['propertyaddress'] . "</td>"  . "<td>" . $row['proppostzip'] . "</td>" . "<td>" . $row['value'] . "</td><td>" . "<a href=\"edit.php\"/> edit</a>" . "</tr>";
    	 
    }
    echo "</table>";
    ?>
  • whitep8
    New Member
    • Oct 2009
    • 65

    #2
    ok, ive tested this on the edit.php page, and it seems to work, i just need to get my syntax correct.

    this is the line that i need corrected so that the href is edit.php?id=$ro w['id']



    Code:
       echo "<tr><td>" . $row['propertyaddress'] . "</td>"  . "<td>" . $row['proppostzip'] . "</td>" . "<td>" . $row['value'] . "</td><td>" . "<a href=\"edit.php?id=\"/>" .  "edit</a>" . "</tr>";

    Comment

    • whitep8
      New Member
      • Oct 2009
      • 65

      #3
      lol

      i found it

      sorry im impatient

      Code:
      . "<a href=\"edit.php?id=" . $row['ID'] . "\"/>edit</a>" . "</tr>";

      Comment

      Working...