php links
Posted: Wed Jan 14, 2009 5:12 pm
Hey guys,
I am building a website and need a little help with php links.
Here is my current code.
What I want to know is how can I actually link to a page using this format. I want the URL in the to browser to read:
instead of:
I'm going for an effect similar to this:
I read somewhere that I would need to use $_GET. I am kind of a beginner and don't really know how to do this. Any suggestions? If you nee more info let me know and I'll post it. Thanks in advance.
-Dave
I am building a website and need a little help with php links.
Here is my current code.
Code: Select all
<?php
error_reporting(E_ALL ^ E_NOTICE);
$sql = "SELECT id, stateName
FROM states
ORDER BY stateName ASC";
$rs = mysql_query($sql) or die(mysql_error());
print "<ul id=\"state_nav\">";
while($row = mysql_fetch_array($rs,MYSQL_ASSOC)) {
print "<li>";
print "<a href=\"resorts.php?state=".$row[id]."\">$row[stateName]</a>";
print "</li>";
}
print "<ul>";
?>
Code: Select all
http://www.mysite.com/resorts.php?state=CTCode: Select all
http://www.mysite.com/CT.phpCode: Select all
http://skiing.alpinezone.com/resorts/?state=CT-Dave