I am hoping there is some nice programmer who is willing to give me a hand. I am pretty new to PHP and barely know enough to be dangerous. All the tutorials I found on the net are pretty old and use the Register_Globals. I made a page using the old style code. However, recently, I had my Hosting company move my site from a server with PHP 4 on it to a server that has PHP 5. Now my code don;t work anymore.
I am basically trying to make a page that has the states listed in HTML. Each state has a hardcoded link to pass a variable for that state. When you click on the link for a state, only that state's info should be displayed. However, I am having a difficult time understanding how to make the Superglobals work.
This is the code as it was on the PHP 4 server with Register Globals on.
Any input would be soooooo appreciated.
<?php
$db = mysql_connect("localhost", "user", "pass");
mysql_select_db("database1",$db);
if ($state) {
$result = mysql_query("SELECT * FROM table1 WHERE state='$state'",$db) or die ('Error: '.mysql_error ());
$myrow = mysql_fetch_array($result);
printf("<TABLE BORDER=1 CELLSPACING=2 CELLPADDING=2><TR ALIGN=CENTER><TD><FONT SIZE=+2 COLOR=#000088>PICTURES</FONT></TD><TD><FONT SIZE=+2 COLOR=#000088>DOWNLOAD</FONT></TD><TD><FONT SIZE=+2 COLOR=#000088>REQUIREMENTS</FONT></TD></TR>");
printf("<TR ALIGN=CENTER><TD>%s</TD><TD><a href=%s/%s>%s</a><BR><a href=%s/%s>%s</a></TD><TD>%s</TD></TR>", $myrow["desc"], $_SERVER['PHP_SELF'], $myrow["p01"], $myrow["p01d"], $_SERVER['PHP_SELF'], $myrow["p02"], $myrow["p02d"], $myrow["req"]);
printf("</TABLE>");
} else {
printf("<FONT SIZE=+3 COLOR=#FF0000 FACE=Tahoma><HR WIDTH=300><B>Please make a selection<B><BR><HR WIDTH=300></FONT>");
}
?>