Page 1 of 1

Passing a variable via the php header redirect

Posted: Wed Nov 11, 2009 12:55 am
by edawson003
For some reason, the below is erroring out. Any thought how I can get this to work with variable?
header( "Location: http://www.url.com/file.php?maexid=$_GET['maexid']" );

Re: Passing a variable via the php header redirect

Posted: Wed Nov 11, 2009 1:45 am
by requinix
Bad syntax. If you want to put a variable like that in a string you need to do it differently.

Re: Passing a variable via the php header redirect

Posted: Wed Nov 11, 2009 3:53 am
by papa
Can probably do it like this:

Code: Select all

 
$maexid = $_GET['maexid'];
header( "Location: http://www.url.com/file.php?maexid=$maexid" );
 
 

Re: Passing a variable via the php header redirect

Posted: Wed Nov 11, 2009 4:31 am
by edawson003
Thanks!