Jump to content

[SOLVED] Having problems with $_GET.


kateevanne

Recommended Posts

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

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.

Archived

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

×
×
  • Create New...

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.