Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.