Jump to content

[SOLVED] t variable unexpected


AsiaUnderworld

Recommended Posts

should be a simple fix this, but my mind has just gone, late night :P

 

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

      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 />';

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");

	}

}
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.