Jump to content

how to get or post the value from link to HTML form?


sigmahokies
Go to solution Solved by Ch0cu3r,

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • Solution

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.