HI,
I am VERY new to PHP…written a little test page to allow users to select a date so they can view their disc golf scores from a the relevant round. I can get the pull-down menu working from the dataase AND pull the data from the databse IF I give it the right date BUT can’t get the value selected in the pull-down menu to go into the code to pull up the data…I am being stupid but please any advice would be SO well received.
I basically need to know what’s wrong with the code below and if I should open a new page to display the results from the database or can I keep the whole thing on one page.
First PHP Script <?php mysql_connect(localhost,myusername,mypassword) or die("Unable to connect to database"); @mysql_select_db("myusername_discgolf") or die("Unable to select database myusername_discgolf"); $query = "SELECT DISTINCT date FROM scores ORDER BY date"; $result = mysql_query($query) or die("Query failed"); while ($line=mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { print "".$col_value; } } ?> <?php $sqlquery = "SELECT * FROM scores WHERE date = $_POST['sel_date']"; $result = mysql_query($sqlquery); $number = mysql_numrows($result); $i = 0; if ($number < 1) { print "There Were No Results for Your Search"; } else { while ($number > $i) { $membername = mysql_result($result,$i,"Name"); $hole1 = mysql_result($result,$i,"Hole 1"); print "
Name: $membername
Hole 1: $hole1