By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,747 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,747 IT Pros & Developers. It's quick & easy.

Carrying a variable from PHP form

P: 1
Ok, kinda of stumped on this and i've been away from PHP development for a while some i'm a tad lost.

I have a database search for where if you enter the name of a location and submit it queries the database and returns the matches, simple enough.

Now, what I would like to do is take the ID of the entry, let's say the restaurant_id and make the display name (rest_name) as a link with that id number and be able to populate a dynamic page with the restaurant details (which would query from 2 seperate tables in the same MySQL DB).

It would include details of the location, current items and list of past items. Now how would I go about carrying the id from one dynamic page to the other and also change the name returned into a link in order to create the other page and query the two tables?

Pardon me for being such a n00b ;)
Feb 15 '07 #1
Share this Question
Share on Google+
2 Replies


cassbiz
100+
P: 202
In your databases itself the field 'restaurant_id' will have to also be in the other databases.

Once you have the same field name in both (all) databases then you can query the id and have it pull from multiple databases in your select statement.

This is the easiest way.
Feb 15 '07 #2

ak1dnar
Expert 100+
P: 1,584
Hi xcoaster1,
Let me clear it up.I think your first page is working fine and its generating the result as per the need.so here after you want to display each an every restaurant with details.

you can do like this, display all your results as links with the names of the restaurants. then by using the restaurant ID you can call for the the next page with all the info.You have to fetch the id and assign it in a variable.

[PHP]
<a href="details.php?id=Print Your Id here">Restuarant Name</a>
[/PHP]

from the details.php page get the value using:
[PHP]
$id = $_GET['id'];
[/PHP]

coding is up to u. because u did not submit your one so far, you have completed.
Feb 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.