Jump to content

[SOLVED] Using variables


alexiek

Recommended Posts

Hello everybody, I'm new to PHP. My issue is, I can't seem to figure out how I can take data I received, put it into a variable and resend the data. Example:

I have a site and when a link is clicked it goes link.php?data=hello. Now, how I can I use the data and then resend it. link.php then refreshes itself and sends the data to the next site. So then it would go data.php?data=hello&referrer=link. And in following this, how can I make var $data have data that was sent using link.php. Get it? Thanks much.

Link to comment
https://forums.phpfreaks.com/topic/36852-solved-using-variables/
Share on other sites

<?php

$data = $_GET['data'];

echo "<a href='link.php?data=$data&referrer=4512'>link</a>";

?>

 

Then it just keeps continuing from there. To put "referrer into a variable you would just go $referrer = $_GET['referrer']...which would hold the value "4512" in this case.

 

$_GET is the method you use to grab values out of the URL.

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.