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. Link to comment https://forums.phpfreaks.com/topic/58747-solved-supplying-details-to-page-through-url/ 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. Link to comment https://forums.phpfreaks.com/topic/58747-solved-supplying-details-to-page-through-url/#findComment-291428 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.''; } ?> Link to comment https://forums.phpfreaks.com/topic/58747-solved-supplying-details-to-page-through-url/#findComment-291439 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. Link to comment https://forums.phpfreaks.com/topic/58747-solved-supplying-details-to-page-through-url/#findComment-291447 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.