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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.