jmilane Posted September 25, 2006 Share Posted September 25, 2006 I want to send people a link that, when clicked, will open a php page which searches based on an id number. The id number will have to be appended to the end of the url.How do I set this up? Do I have to take the id number off of the url in the processing script and then incorporate it into a query?I know this probably has to do with the "?" in php URLs - but I am extremely new. Thank you. Quote Link to comment Share on other sites More sharing options...
trq Posted September 25, 2006 Share Posted September 25, 2006 A simple example.[code=php:0]<?php if (isset($_GET['id'])) { echo "You clicked foo"; } else { echo "<a href='?id=foo'>foo</a>"; }?>[/code]This is all within one page but should give you the idea. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 25, 2006 Share Posted September 25, 2006 http://www.somewhere.com/go_here.php?id=8972As a very simple example:[code]<?php// go_here.phpif (isset($_GET['id'])) { $id = $_GET['id']; // retrieve id value passed by URL} else { exit();}... your code follows ...[/code] Quote Link to comment Share on other sites More sharing options...
jmilane Posted September 25, 2006 Author Share Posted September 25, 2006 [quote author=thorpe link=topic=109415.msg440924#msg440924 date=1159193906]A simple example.[code=php:0]<?php if (isset($_GET['id'])) { echo "You clicked foo"; } else { echo "<a href='?id=foo'>foo</a>"; }?>[/code]This is all within one page but should give you the idea.[/quote]So the $_GET var would be passed just in the url... like www.mysite.com/search?id=fooBut then the file itself would simply be named www.mysite.com/search.php?And then the $_GET var would be whatever immediately follows the ? (in this case 'id'?)Thanks! Even if I am wrong... Quote Link to comment Share on other sites More sharing options...
mendoz Posted September 25, 2006 Share Posted September 25, 2006 [quote author=jmilane link=topic=109415.msg440932#msg440932 date=1159194181][quote author=thorpe link=topic=109415.msg440924#msg440924 date=1159193906]A simple example.[code=php:0]<?php if (isset($_GET['id'])) { echo "You clicked foo"; } else { echo "<a href='?id=foo'>foo</a>"; }?>[/code]This is all within one page but should give you the idea.[/quote]So the $_GET var would be passed just in the url... like www.mysite.com/search?id=fooBut then the file itself would simply be named www.mysite.com/search.php?And then the $_GET var would be whatever immediately follows the ? (in this case 'id'?)Thanks! Even if I am wrong...[/quote]It will be named www.mysite.com/search.php, 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.