sigmahokies Posted September 29, 2015 Share Posted September 29, 2015 Hi everyone, I am still learning PHP, I am trying to "update" the data in the database, I succeed create page to add (insert) the data in the database, but I can't figure how to update that the data come from link from previous page. Is that correct for script link to transfer to HTML form in other page in below of here? echo "<tr><td>".$row['FirstName']."</td><td>".$row['LastName']."</td><td>".$row['Email']."</td><td><a href='update.php?edit=$row[iD]'>EDIT</a></td></tr>"; the message shows me "update.php?edit=1" at left-bottom of website. But I clicked link to other page, seem the value has not passing to other page that i want to update in HTML form. Can you help? Thank you in advance time. Gary Quote Link to comment https://forums.phpfreaks.com/topic/298365-how-to-get-or-post-the-value-from-link-to-html-form/ Share on other sites More sharing options...
BuildMyWeb Posted September 29, 2015 Share Posted September 29, 2015 (edited) it would help if you show both scripts. do you catch the value from your url in your handler script? $id_to_edit = $_GET['edit']; Edited September 29, 2015 by BuildMyWeb Quote Link to comment https://forums.phpfreaks.com/topic/298365-how-to-get-or-post-the-value-from-link-to-html-form/#findComment-1521878 Share on other sites More sharing options...
sigmahokies Posted September 29, 2015 Author Share Posted September 29, 2015 I'm not sure I understand...using $_GET? it will be visual to computer, I rather to use $_POST than $_GET. I know how to write $_POST and $_POST in other page. In other page that I write: <tr><td>Identify Number:</td><td><?php echo $edit['ID']; ?></td></tr> But the value from the previous has not appear in HTML form in this current page from the previous page. Quote Link to comment https://forums.phpfreaks.com/topic/298365-how-to-get-or-post-the-value-from-link-to-html-form/#findComment-1521882 Share on other sites More sharing options...
Solution Ch0cu3r Posted September 29, 2015 Solution Share Posted September 29, 2015 You use $_GET to grab the values from the url - which is called the querystring (the stuff that is after the ?). You cant use $_POST with a link. As BuildMyWeb said $_GET['edit'] will contain the id value from your link. Your next step is to query the database where $_GET['edit'] matches a row with the same id. From the result of the query you then populate your form fields. Quote Link to comment https://forums.phpfreaks.com/topic/298365-how-to-get-or-post-the-value-from-link-to-html-form/#findComment-1521885 Share on other sites More sharing options...
sigmahokies Posted September 29, 2015 Author Share Posted September 29, 2015 Ohhh, i don't know about that...I can see $_POST is useless to pass the value, only $_GET can do that... Some articles about $_POST and $_GET are not clear, I just understand that $_POST is an invisible, $_GET is visible. Now, you just clear my puzzled, Thank you! Gary Quote Link to comment https://forums.phpfreaks.com/topic/298365-how-to-get-or-post-the-value-from-link-to-html-form/#findComment-1521894 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.