PDA

View Full Version : links to next page


designingamy
05-29-2008, 10:33 AM
Let's say I have an Alaska map with all the Alaska boroughs on it. I click Denali on the map which will take me to the next page with a table of all the listings of people I know in that area.

I know how to use Webstudio to add the link from Denali to the next page. But my problem lies in php. I know how to write the code to pull out the information from the database, but how does the listing page know how to pull the listings out for the Denali opposed to Kodiak Island since it is on a different page?

Thanks bunches in advance!
~Amy
:help:

Vege
05-29-2008, 11:05 AM
http://www.w3schools.com/PHP/php_get.asp
Meaning you can make the link pass some variables that you then use with that sql query.

designingamy
05-29-2008, 11:24 AM
Hmmm..I'm still a little confused on which one I'd use. Get Post or Request? I thought I'd have to use a session somehow?

What's on page 681?

Jim7283
05-29-2008, 11:39 AM
No sessions needed, just some conditional statements:


if (isset($_POST['denali']))
{
$sql = mysql_query("SELECT * FROM yourtable WHERE somevalue='denali'") or die(mysql_error());
print '<table>';
while ($row = mysql_fetch_object($sql))
{
print '<tr><td>' . $row->columnname . '</td></tr>';
}
print '</table>';
}


You'll obviously need to modify the query to match your needs, and then it is just a matter of adding the proper print statements to output the data in your table. Using the example provided, you can use the object $row->columnname as many times as needed within the while loop to output the data. Just replace columnname with the appropriate column from your DB.

Vege
05-29-2008, 02:20 PM
What's on page 681?
Jesus dies.

designingamy
06-02-2008, 05:37 PM
I think I have it now :) Thank you!