LCrane86
-
Posts
2 -
Joined
-
Last visited
Never
Posts posted by LCrane86
-
-
Hello,
I'm trying to build a small project; and as part of it - I want users to search and when presented with relevant enteries in the SQL database - they should be able to click and retrieve a page dedicated to that entity.
The problem I am having is in passing the 'id' of the search result onto the next (description) page.
$SQL = "SELECT * FROM loads"; $result = mysql_query($SQL); while ($db_field = mysql_fetch_assoc($result)) { $clickid = $_GET['id']; print $db_field['id'] ."<a href=\"load_info.php?id=$id" . $id . "\" target=\"_self\" title=\"\">More Info</a>;"; print $db_field['depart:'] . "<BR>"; print $db_field['dest'] . "<BR>"; }
I thought it was easy enough to pass the variable like above ("load_info.php?id=$id) and then grab it on the next page like so:
$val = $_GET['clickid'];
Unfortunately, it doesn't retrieve the info from the page before. If I insert a number in there, it does work correctly, but I really need the ID of the database entry to pass on so as to provide the user with further information.
If anyone could help it would be appreciated.
L.
Help Passing Variable into next page
in PHP Coding Help
Posted
Thanks for your help, but I'm still not successful in sorting this.
The generic links page is here: http://www.space.greensenvironmental.com/all_loads.php (just provides all records in the load table.)
It should forward the $clickid into the next page(, but it doesn't. I've noticed the address bar at the bottom fails to show $clickid within " load_info.php?id=$clickid" - unless I do a injection attack in the address bar, it emerges with the id number.
All Loads
And the second page doesn't seem to 'grab' the $clickid var
Something so small is really stopping my progress!
L.