HTML - Transmission of a "variable" in PHP

April 2018


With HTML and PHP, I want to retrieve (in a page) the value of a field of a record in a table. Then, at the click of a button (in a form on this page) this value should be sent to another page (the form's action).

But I do not know how to pass this value
I tried with the transmission URL variable but believe that I put as a string, so it's useless.

For example, if I put in the URL mysite/page.php?variable1=$ variable_to_transmit I think he sent the string "$ variable_to_transmit" and not the content of the variable$ variable_to_transmit. "I already know that this is normal since I use a variable declared in the PHP's internal URL that is in html but I do not know another way.


If you use a form, you will have a more elegant solution:

And you're recovered in the following page with $ _POST ['variable1']
This solution has the advantage of not burdening your URL and makes the variable "invisible" user.


Thanks to swoog42 for this tip.
Published by aakai1056. Latest update on April 7, 2010 at 06:02 AM by aakai1056.
This document, titled "HTML - Transmission of a "variable" in PHP," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (
PHP - test the internet connection
PHP - Change the greetings message on you website