I have a drop-down list on a page that has either "NEW" as a value, or an existing item from the db. When that form is submitted, it goes to a page where I have another form. I want an if/then statement that says if the value from the previous form = "NEW", then don't do anything. Otherwise, run a db query to get the info on the item the user DID select to populate the form on the new page.
Here's what I have:
//posted value from previous page form
$Course_Code = $_POST['Course_Code'];
if ( $Course_Code == NEW ){
die();
}
else {
$sql = "SELECT TOP 1 * FROM table_name WHERE Course_Code=$Course_Code ORDER BY Date";
$result=mysql_query($sql);
$rows=mysql_fetch_array($result);
}
However I get this error:
Parse error: parse error, unexpected ')', expecting T_STRING or T_VARIABLE or '$' in /......... on line 24
Line 24 is where the if statement begins. What am I doing wrong?