If you want to pass the php variables from one page to another, especially when you have to update any rows in a table, you have to use a specific tips for that.
Usually you have to pass on the variables from one page to another page by defining the variables through URLs.
For example
www.webypost.com/status?=myvariabletodefine
You have to use the sessions for the easy way of passing variables from one page (page1.php) to other php page (page2.php)
Follow the below code to acheive this and pass on the varibles to use the same for any other queries to run on to 'echo' the same varible in the other page.
Code should be included in Page1.php
Code of page1.php
page 2';
// Or pass along the session id, if needed
echo '
page 2';
?>
Code should be included in Page2.php
';
echo $_SESSION['favcolor']; // green
echo $_SESSION['animal']; // cat
echo date('Y m d H:i:s', $_SESSION['time']);
// You may want to use SID here, like we did in page1.php
echo '
page 1';
?>
In this way you can pass on the varible from one page to other page.
Suggested Reading: How to Intercept a jquery ajax call with confirm
Leave a Comment
Login to post a public Comment
Comments 1.
Very useful thank you infact