kateevanne Posted May 10, 2009 Share Posted May 10, 2009 Hi All, I am a newbie to php and having real problems with $_GET, I have a link that links to a page like so: echo "<a href=\"photo.php?id=$row[id]\"><img src={$row['file']}/></a><br>"; and the page uses $_GET['id'] (then made into a variable $id) to display the picture, this works fine. The problem I am having is that I need to put a comments form on this page also, where a user can leave a comment about the picture, but when I try to reuse the variable $id to insert the picture id into a mysql table it doesnt work. Any Advice? Link to comment https://forums.phpfreaks.com/topic/157570-solved-having-problems-with-_get/ Share on other sites More sharing options...
dreamwest Posted May 10, 2009 Share Posted May 10, 2009 change: echo "<a href=\"photo.php?id=$row[id]\"><img src={$row['file']}/></a><br>"; to echo "<a href=\"photo.php?id=".$row[id]."\"><img src={$row['file']}/></a><br>"; having the way it was would $_GET an id of "$row[id]" Link to comment https://forums.phpfreaks.com/topic/157570-solved-having-problems-with-_get/#findComment-830931 Share on other sites More sharing options...
GingerRobot Posted May 10, 2009 Share Posted May 10, 2009 change: echo "<a href=\"photo.php?id=$row[id]\"><img src={$row['file']}/></a><br>"; to echo "<a href=\"photo.php?id=".$row[id]."\"><img src={$row['file']}/></a><br>"; having the way it was would $_GET an id of "$row[id]" Not true. Variables inside double quotes are parsed. kateevanne, i think we're going to need some more of your code to help. Post it up inside tags. Link to comment https://forums.phpfreaks.com/topic/157570-solved-having-problems-with-_get/#findComment-830939 Share on other sites More sharing options...
kateevanne Posted May 10, 2009 Author Share Posted May 10, 2009 Hey All, Thanks for that, - I found the problem in the end- I had to put the same link into my form as was the link to the page- I had PHP_SELF. Silly mistake but was super frustrating! Link to comment https://forums.phpfreaks.com/topic/157570-solved-having-problems-with-_get/#findComment-830959 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.