RE: editing, deleting records

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a table cell with a link to the page processing the edit/del

example

print ("<td><a href=\"edit.php?id=" . $row['id'] . "\">EDIT</a></td>");


 >           print("<td>" . $lname . "</td><td>" . $fname . "</td><td>"
 >           . $dob . "</td><td>" . $phone . "</td><td>" . $address
 >           . "</td><td>" . $email . "</td><td>" . $sex . "</td>");
 >           print("</tr>");
 >         }


This will send the user to edit.php where you'll have a form that will
process the edits.

The same would hold true with delete.php

Gil



 > -----Original Message-----
 > From: Kirk Babb [mailto:kbbabb@xxxxxxxx]
 > Sent: Thursday, January 22, 2004 12:55 PM
 > To: php-db@xxxxxxxxxxxxx
 > Subject:  editing, deleting records
 >
 >
 > Here's a part of my code, which is retrieving player records from mysql
 > and displaying them in a table:
 >
 > -----------------------------------------
 > if($queryChk3 !== 0){
 >         print("<form action='$_SERVER['PHP_SELF']' method='POST'>
 >           <input type='hidden' name='teamID' value='$teamID'>
 > 	  <input type='hidden' name='pwd' value='$pwd'>
 >           <table border='1'><tr>
 >             <td colspan='7'><b>Player Roster for $teamName</b></td></tr>
 >             <tr><td><b>Last Name</b></td><td><b>First Name</b></td>
 >             <td><b>DOB</b></td><td><b>Telephone</b></td>
 >             <td><b>Address</b></td><td><b>Email</b></td>
 >             <td><b>Sex</b></td></tr>");
 >         while($row = mysql_fetch_array($query3)) {
 >           print("<tr>");
 >           $lname   = $row['lname'];
 >           $fname   = $row['fname'];
 >           $dob     = $row['dob'];
 >           $phone   = $row['phone'];
 >           $address = $row['address'];
 >           $email   = $row['email'];
 >           $sex     = $row['sex'];
 >           print("<td>" . $lname . "</td><td>" . $fname . "</td><td>"
 >           . $dob . "</td><td>" . $phone . "</td><td>" . $address
 >           . "</td><td>" . $email . "</td><td>" . $sex . "</td>");
 >           print("</tr>");
 >         }
 >         print("</table><input type='submit' name='Submit'></form>");
 >       }
 > ------------------------------------------
 >
 > I'd like to add buttons to "edit this record" and "delete this record"
 > to each row but I'm not sure how to get it done.  It seems like I'd have
 > to add a hidden variable (playerID, which is my primary key for the table
 > "players") to each row printed but how do I manage unique "submits" since
 > I'm already inside a form?  I must be missing something obvious -
 > please help!
 >
 > Thanks,
 >
 > Kirk
 >
 > --
 > PHP Database Mailing List (http://www.php.net/)
 > To unsubscribe, visit: http://www.php.net/unsub.php
 >

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux