0
Thanks

A few words of thanks would be greatly appreciated.

HTML - Transmission of a "variable" in PHP




Issue


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.

Solution


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.

Note


Thanks to swoog42 for this tip.
0
Thanks

A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
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 (ccm.net).

0 Comments