I am getting follwing error: Parse error: syntax error, unexpected ‘}’ in /home/a7862548/public_html/register.php on line 39
the code is [code]
<?php
session_start();
include(“includes/connect.php”);
include(“includes/html_codes.php”);
if(isset($_POST[‘submit’])){
$error = array();
//username
if(empty($_POST['username'])){
$error[] = 'Please enter a username. ';
}else if( ctype_alnum($_POST['username']) ){
$username = $_POST['username'];
}else{
$error[] = 'Username must consist of letters and numbers only. ';
}
//email
if(empty($_POST['email'])){
$error[] = 'Please enter your email. ';
}else if(preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['email'])){
$email = mysql_real_escape_string($_POST['email']);
}else{
$error[] = 'Your e-mail address is invalid. ';
}
//password
if(empty($_POST['password'])){
$error[] = 'Please enter a password. ';
}else{
$password = mysql_real_escape_string($_POST['password']);
}
if(empty($error)){
//ok
}else{
$error_message
}
}
?>
Register
<?php headerAndSearchCode(); ?>
<section id="right_side">
<form id="generalform" class="container" method="post" action="">
<h3>Register</h3>
<?php echo $error_message; ?>
<div class="field">
<label for="username">Username:</label>
<input type="text" class="input" id="username" name="username" maxlength="20"/>
<p class="hint">20 characters maximum (letters and numbers only)</p>
</div>
<div class="field">
<label for="email">Email:</label>
<input type="text" class="input" id="email" name="email" maxlength="80"/>
</div>
<div class="field">
<label for="password">Password:</label>
<input type="password" class="input" id="password" name="password" maxlength="20"/>
<p class="hint">20 characters maximum</p>
</div>
<input type="submit" name="submit" id="submit" class="button" value="Submit"/>
</form>
</section>
<?php footerCode(); ?>
</div>
[/code]
when i remove if(empty($error)){
//ok
}else{
$error_message
}
the page opens but then i cant validate the form… please help