Forum Moderators: coopster

Message Too Old, No Replies

Can I put variables in the header to pass on?

         

ganderla

6:32 pm on Mar 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So I am learning and trying something new and I have a question.

I have a form when submitted, send me an email and inserts the information into a DB. If everything goes well, they are taken to a thanks page coded like this:

header("Location: thanks.html");

I would like to pass the db info over the URL also.

I thought this would work, but it is just taking me to the thanks page. Can Anyone see what I am doing wrong or if this is just not possible?

header("Location: http://www.example.com/cg/cg.php?fn=<?= $first?>&ln=<?= $last?>&ad=<?= $address?>&ad2=&ct=<?= $city?>&st=<?= $state?>&zp=<?= $zip?>&cn=US&em=<?= $email?>&ph=<?= $phone?>&dm=<?= $dm?>&dd=<?= $dd?>&dy=<?= $dy?>&y=0&d=000&url=http%3A%2F%2Fwww.example.com%2Fthanks.html");

sakg

7:09 pm on Mar 30, 2006 (gmt 0)

10+ Year Member



You can simply use

header("Location: http://www.example.com/cg/cg.php?fn=$first&ln=$last)

Another approach which I use could be:

$newurl="http://www.example.com/test.php?id=" . $id ;
header("Location: $newurl") ;

Andrew Bassett

9:56 pm on Mar 30, 2006 (gmt 0)

10+ Year Member



In your PHP code blocks, I noticed that you're just putting =$var1 instead of echo $var1; which is what I usually do. Maybe it's a feature I've never seen.

ganderla

5:50 am on Mar 31, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It worked with the
header("Location: http://www.example.com/cg/cg.php?fn=$first&ln=$last

Thank you both.