Jump to content

Passing variables, only variable names are printed


2eXtreme

Recommended Posts

Hey guys!

 

Im having trouble sending variables to another php file. This is the code for the php file that sends the data:

 

$number=2;

$number2=3;

header('Location:http://mysite.com/get.php?num=$number&num2=$number2');

 

the receiving file, get.php, is meant to receive the value of $number and ouput it to a .txt file. The code is:

 

$digit = $_GET["num"];

$digit2 = $_GET["num2"];

$log = fopen("log.txt", "a");

fwrite($log, $digit."\n");

fwrite($log, $digit2."\n");

fclose($log);

 

but all the log file contains is:

 

$number

$number2

 

When what I want to be seeing is:

 

2

3

 

Im guessing this comes down to how I've passed the variables in the sending file to the receiving file. Can anyone please tell me what I have to change? Thanks very much for any help given!

 

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.