Carrying a variable from PHP form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xcoaster1
    New Member
    • Feb 2007
    • 1

    #1

    Carrying a variable from PHP form

    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 ;)
  • cassbiz
    New Member
    • Oct 2006
    • 202

    #2
    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.

    Comment

    • ak1dnar
      Recognized Expert Top Contributor
      • Jan 2007
      • 1584

      #3
      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.p hp?id=Print Your Id here">Restuaran t 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.

      Comment

      Working...