JakeSilver Posted June 30, 2008 Share Posted June 30, 2008 Hi there! I am trying to pass multiple variables in a url as follows print "<a href=\"section.php?id=$pagelink&ipanel=" . ($index - $count) . "\"><img src='recent.jpg' id='recent'></a> "; however the URL is displayed as follows:- ??? http://www.??????.com/section.php?id=&ipanel=5 It shows the varible ipanel easily but does not show the "id=" There is definatly a value in $pagelink as i have echoed it at the bottom of the page and i can see that its value is correct? any solutions? Many thanks Jake Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/ Share on other sites More sharing options...
revraz Posted June 30, 2008 Share Posted June 30, 2008 Probably because you have no variable named $pagelink& Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578201 Share on other sites More sharing options...
JakeSilver Posted June 30, 2008 Author Share Posted June 30, 2008 I took the & out... but im sure & was used for the "&" And sign.. the code is now as follows print "<a href=\"section.php?id=$pagelink&ipanel=" . ($index - $count) . "\"><img src='recent.jpg' id='recent'></a> "; But again the same problem exsist where it does not display the first variable ("id") how do i go about seperating the variable from the & sign? got any ideas? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578205 Share on other sites More sharing options...
revraz Posted June 30, 2008 Share Posted June 30, 2008 You did the same mistake again $pagelink&ipanel You need a space after your variable name. Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578208 Share on other sites More sharing options...
JakeSilver Posted June 30, 2008 Author Share Posted June 30, 2008 Included a space after the varible <a href=\"section.php?id=$pagelink &ipanel=" . ($index - $count) . "\"><img src='recent.jpg' id='recent'></a> "; No luck though Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578210 Share on other sites More sharing options...
LooieENG Posted June 30, 2008 Share Posted June 30, 2008 print "<a href=\"section.php?id=" . $pagelink . "&ipanel=" . ($index - $count) . "\"><img src='recent.jpg' id='recent'></a> "; Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578212 Share on other sites More sharing options...
revraz Posted June 30, 2008 Share Posted June 30, 2008 print "<a href=\section.php?id=$pagelink>Link</a>"; Does that work? Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578213 Share on other sites More sharing options...
JakeSilver Posted June 30, 2008 Author Share Posted June 30, 2008 Revaz:- I have just posted the code without the ipanel variable and your right it doesnt show it there either... so therefore the varible appears to be empty.. However at the bottom of the page i echo the varible $pagelink and am given the value of 1 which is correct. I do not understand how this varible is displayed in the page but not in the url? Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578219 Share on other sites More sharing options...
azfar siddiqui Posted July 1, 2008 Share Posted July 1, 2008 This is the right way to create a parametric link : echo "<a href='section.php?id=".$pagelink."&ipanel=".$ipanel."'>THIS IS THE LINK</a>"; Quote Link to comment https://forums.phpfreaks.com/topic/112588-multiple-variables-in-url/#findComment-578820 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.