AsiaUnderworld Posted July 25, 2009 Share Posted July 25, 2009 should be a simple fix this, but my mind has just gone, late night Parse error: syntax error, unexpected T_VARIABLE, expecting '(' on line 36 heres the code : <?php if(isset($_POST['submit'])) { // make all the post vars safe $email = QuerySecure($_POST['email']); /// Check if all fields are filled out and not empty if (strlen($email) < 1 ) echo '<div class="redalert>You have left a field blank, all fields must be completed, please go back and correct this.</div><br />'; elseif $sql = mysql_query("SELECT email FROM pre_register WHERE email = $email LIMIT 1"); if(mysql_num_rows($sql) != 0) echo '<div class="redalert">You have already pre-registered</div><br>'; else { mysql_query("INSERT INTO pre_register SET email = $email"); } } } ?> Link to comment https://forums.phpfreaks.com/topic/167396-solved-t-variable-unexpected/ Share on other sites More sharing options...
ldougherty Posted July 25, 2009 Share Posted July 25, 2009 echo '<div class="redalert>You have left a field blank, all fields must be completed, please go back and correct this.</div><br />'; Your missing a " Should be echo '<div class="redalert">You have left a field blank, all fields must be completed, please go back and correct this.</div><br />'; Link to comment https://forums.phpfreaks.com/topic/167396-solved-t-variable-unexpected/#findComment-882671 Share on other sites More sharing options...
jonsjava Posted July 25, 2009 Share Posted July 25, 2009 you have elseif elseif what? proper format: <?php if(isset($_POST['submit'])) { // make all the post vars safe $email = QuerySecure($_POST['email']); /// Check if all fields are filled out and not empty if (strlen($email) < 1 ){ echo '<div class="redalert">You have left a field blank, all fields must be completed, please go back and correct this.</div><br />'; } elseif($something == $something_else){ $sql = mysql_query("SELECT email FROM pre_register WHERE email = $email LIMIT 1"); if(mysql_num_rows($sql) != 0) echo '<div class="redalert">You have already pre-registered</div><br>'; else { mysql_query("INSERT INTO pre_register SET email = $email"); } } } ?> Link to comment https://forums.phpfreaks.com/topic/167396-solved-t-variable-unexpected/#findComment-882675 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.