peranha Posted November 7, 2007 Share Posted November 7, 2007 What I have is a table with 3 columns, and in the first column, I have it linked to editpost.php? with the id behind it. I need to somehow get that id into the editpost page to bring up the info in 3 text boxes for the user to edit. Not sure as to how to do this. Here is the table info that they will click on to edit items. <TR><TD WIDTH="225"><a href='editpost.php?<?PHP echo $row[0]; ?>'><?PHP echo $row[1]; ?></a></TD><TD WIDTH="460"><?PHP echo $row[2]; ?></TD><TD WIDTH="70" align="center"><?PHP echo $row[3]; ?></TD></TR> Here is the edit page // create query $query1 = "SELECT * FROM table WHERE commid = ?"; Not sure as to what to put in the commid = ?. If anyone can help, that would be great. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/76317-solved-hyperlink-in-table-for-editing-information/ Share on other sites More sharing options...
Michan Posted November 7, 2007 Share Posted November 7, 2007 You need to use the $_GET method to retrieve the id for each page. Firstly, you need to change that link to something like editpost.php?comm=id Then, you can select the result by inserting the following into your code: $commid = $_GET['comm']; Use $commid in your query, and all should work accordingly. Link to comment https://forums.phpfreaks.com/topic/76317-solved-hyperlink-in-table-for-editing-information/#findComment-386366 Share on other sites More sharing options...
pocobueno1388 Posted November 7, 2007 Share Posted November 7, 2007 Edit: Beat to it You need to change your clicking part to this <TR><TD WIDTH="225"><a href='editpost.php?id=<?PHP echo $row[0]; ?>'><?PHP echo $row[1]; ?>[/url]</TD><TD WIDTH="460"><?PHP echo $row[2]; ?></TD><TD WIDTH="70" align="center"><?PHP echo $row[3]; ?></TD></TR> Now on the page where you grabbing the information to edit, you would simply do this <?php $id = $_GET['id']; $query1 = "SELECT * FROM table WHERE commid = $id"; ?> Link to comment https://forums.phpfreaks.com/topic/76317-solved-hyperlink-in-table-for-editing-information/#findComment-386369 Share on other sites More sharing options...
peranha Posted November 8, 2007 Author Share Posted November 8, 2007 Thanks for the help, Works Great. Link to comment https://forums.phpfreaks.com/topic/76317-solved-hyperlink-in-table-for-editing-information/#findComment-387252 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.