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. Quote Link to comment 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. Quote Link to comment 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"; ?> Quote Link to comment Share on other sites More sharing options...
peranha Posted November 8, 2007 Author Share Posted November 8, 2007 Thanks for the help, Works Great. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.