Jump to content

passing variables


nikhar021

Recommended Posts

To send a variable using POST you'll need to use a html form.

Here's how you would setup the form:

<form action="location of the file you want to send the variable to" method="post">
<input type="hidden" value="the variable value" name="formvariable" />
<input type="submit">
</form>

 

Then put this in the receiving document put:

<?php $variable=$_POST['formvariable']; ?>

 

But this method of moving a variable between 2 pages involves the viewer clicking on the submit button to send the variable, it would be better if you used GET or SESSION to send the variable. Though you could use Javascript to make the form submit on page load.

Link to comment
https://forums.phpfreaks.com/topic/101682-passing-variables/#findComment-520215
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.