nadz Posted July 6, 2007 Share Posted July 6, 2007 hi, basically i'd like my users to be able to give their friends a link like this: ww.mysite.com/index.php?id=[users id number] and id like to use the id number supplied in a mysql query on the page. in abit more detail, the page contains a form , the friend fills the form in and the contents are logged in a database so it can be viewed by the user who sent the link. i already have the link output ready thanks to some members in another thread, but i need to know how to make the page pick up the id. this is what i got so far: <?php if(!isset($id)) { echo "no id supplied"; } if(isset($id)) { echo '$id'; } ?> unfortunately it echoes "no id supplied" even when i give an id. Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 <?php if(!isset($_GET['id'])) { echo "no id supplied"; }else { $id = $_GET['id']; } if(isset($id)) { echo '$id'; } ?> Try that. Quote Link to comment Share on other sites More sharing options...
nadz Posted July 6, 2007 Author Share Posted July 6, 2007 hi, thanks for your help. i tried it and it echoed "$id" so i put an extra pair of single quotes around it and it worked. like this: if(!isset($_GET['id'])) { echo "no id supplied" }else { $id = $_GET['id']; } if(isset($id)) { echo ''.$id.''; } ?> Quote Link to comment Share on other sites More sharing options...
per1os Posted July 6, 2007 Share Posted July 6, 2007 My bad if(isset($id)) { echo "$id"; } Anything inside single quotes is taken literally. Quote Link to comment 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.