Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send extra variables in a post from a form?

Tags:

html

php

In my php script I have additional variables I don't want visible to the user to be sent in a _post from a to another php script. How do I do that?

like image 340
Acklavidian Avatar asked Jul 15 '13 21:07

Acklavidian


People also ask

What is $_ POST method?

PHP $_POST is a PHP super global variable which is used to collect form data after submitting an HTML form with method="post". $_POST is also widely used to pass variables.

What are post variables?

The $_POST variable is an array of variable names and values sent by the HTTP POST method. The $_POST variable is used to collect values from a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send.

Which variable will be used to pick the value using post method?

The $_REQUEST variable The PHP $_REQUEST variable can be used to get the result from form data sent with both the GET and POST methods.


2 Answers

Hidden input fields:

<input type="hidden" name="var" value="..." />
like image 77
Jason McCreary Avatar answered Sep 20 '22 12:09

Jason McCreary


  • use sessions (pros: does not need to be reposted, stays in php between scripts)
  • use input hidden html fields
like image 23
Sebas Avatar answered Sep 21 '22 12:09

Sebas