Forum Moderators: coopster

Message Too Old, No Replies

Passing a variable to a new page

php variable new page

         

swapshop

10:32 am on Jun 4, 2008 (gmt 0)

10+ Year Member



Need some advice on how to pass a variable to a new page

<u><a href='user-feedback.php?user_id={$user_id}")'><u>Check Users Feedback</a></u></small>

the variable here that I need is the on the advert details page called $user_name

The link above when clicks goes to a new page to allow the person to place feedback on the seller.

When on the details page the $user_name variable is there say sarah

I want to use the $user_name to pre fill the form name on the feedback page

How do I page the variable to a new page?

Ie is there like a global variable?

Issue is due to too totally separate scripts being used. But all I need is to have the variable from page on passed to page two

PHP_Chimp

10:52 am on Jun 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can pass variables through GET or POST or if you want the variable to be invisible to the user then you could use a session.
I guess that as you are using GET already then you could continue to use that to pass the variable over to another page.

Or are you saying that you are using a GET request, but dont know how to access those variables?
If so use $_GET['user_id'] in your case.

Try:


echo '<pre>POST';
print_r($_POST);
echo 'GET'
print_r($_GET);
echo '</pre>';

As that will show you what is happening with the requests.