Jump to content


This topic is now archived and is closed to further replies.


Variable in Another File

Recommended Posts

Hey All,

I have two pages and I am trying to pass a variable called $hlink from page1.php to page2.php. I was just wondering if someone could help me out? This is what I have been using:

On page1.php:


echo '<a href="page2.php?string11= . $hlink . ">String is:</a>';



On page 2 I have :

if (isset ($_GET['string11'])) echo $_GET['string11'];


My variable $hlink stores a title that I want to bring up again on page2.php; however, the only thing that pops up is the output ".$hlink." Any suggestions?

Share this post

Link to post
Share on other sites
[!--quoteo(post=383455:date=Jun 13 2006, 04:25 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 13 2006, 04:25 PM) [snapback]383455[/snapback][/div][div class=\'quotemain\'][!--quotec--]
echo "<a href=\"page2.php?string11=$hlink\">String is:</a>";

Thanks Joquius!!! That definitely worked [img src=\"style_emoticons/[#EMO_DIR#]/smile.gif\" style=\"vertical-align:middle\" emoid=\":smile:\" border=\"0\" alt=\"smile.gif\" /]

Share this post

Link to post
Share on other sites
You can also do it without escaping the double quotes...
[code]<?php echo '<a href="page2.php?string11=' . $hlink . '">String is:</a>'; ?>[/code]
You'll notice that I added a single quote after the "=" and before the following double quote in your original code.


Share this post

Link to post
Share on other sites


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.