greencoin Posted June 12, 2007 Share Posted June 12, 2007 For those of you who were with me on my last question, I'm making a form where one of the results is created by a range of dates. I have 2 drop down boxes that are populated with "date" data from the table and they pass it onto the results page using the "Post" method. My host is Godaddy / Linux and my table is MySQL ver 4.1 I can populate my drop boxes using multiple queries - for some reason the code other forum members have been giving me to populate those boxes using a single query isn't working... When I click the submit button, I get "Parse error: parse error, unexpected ' .././..track_date_results.php on line 5 ********************************************************************************************* Here's the code from the search page; $query = 'SELECT date FROM GC_Tracker'; $result = mysql_query($query) or die(mysql_error()); $select_options = array(); if ($result && mysql_num_rows($result)) while ($row = mysql_fetch_row($result)) $select_options[] = "\t<option value=\"$row[0]\">$row[0]</option>\n"; ?> Select<form method="POST" action="track_date_results.php"> <select size="1" name="min"> <?php echo implode('',$select_options); ?> </select> <select size="1" name="max"> <?php echo implode('',$select_options); ?> </select> <input type="submit" value="Submit" name="B1"> <input type="reset" value="Reset" name="B2"> </form> and this is the code on the results page; if (isset($_POST['min']) && isset($_POST['max']) { // where min and max are the names of the two form fields. $sql = "SELECT * FROM GC_Tracker WHERE date >= '{$_POST['min']}' && date <= '{$_POST['max']}'"; if ($result = mysql_query($sql)) { if (mysql_num_rows($result)) { $i = 0; echo "<TABLE BORDER=\"1\">\n"; echo "<TR bgcolor=\"lightblue\"><TD>Company</TD><TD>Phone</TD><TD>City</TD></TR>\n"; while ($row = mysql_fetch_array($result)) { if ($i % 2) { echo "<TR bgcolor=\"yellow\">\n"; } else { echo "<TR bgcolor=\"white\">\n"; } echo "<TD>".$row['customer']."</TD><TD>".$row['phone']."</TD><TD>".$row['city']."</TD>\n"; echo "</TR>\n"; $i++; } echo "</TABLE>\n"; } else { echo "No results found"; } } else { echo "Query failed<br />" . $sql . "<br />" . mysql_error(); } } else { echo "form not submitted"; } ?> Your help is greatly appreciated as I'm almost done! Thanks in advance ~Rich Quote Link to comment https://forums.phpfreaks.com/topic/55326-solved-newbie-parse-error-with-if-isset_postmin-isset_postmax/ Share on other sites More sharing options...
Wildbug Posted June 12, 2007 Share Posted June 12, 2007 You're missing the closing parenthesis in that first line. Quote Link to comment https://forums.phpfreaks.com/topic/55326-solved-newbie-parse-error-with-if-isset_postmin-isset_postmax/#findComment-273471 Share on other sites More sharing options...
greencoin Posted June 12, 2007 Author Share Posted June 12, 2007 AHHHH!!! The grasshoppa has truly learned from the master! I will pay more attention in the future - thanks, you're a life saver!! ~Rich Quote Link to comment https://forums.phpfreaks.com/topic/55326-solved-newbie-parse-error-with-if-isset_postmin-isset_postmax/#findComment-273489 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.