Parse error: syntax error, unexpected '='

Discussion in 'Web Design and Development' started by JLEW700, Jul 25, 2009.

  1. JLEW700 macrumors 6502

    Joined:
    Aug 12, 2008
    #1
    Im trying to run my code for a registration page, and when i try to go to the registration page it says:
    "Parse error: syntax error, unexpected '=' in /Applications/XAMPP/xamppfiles/htdocs/register.php on line 10"
    could someobody please tell me were I went wrong

    Heres my code:
    Code:
    <?php
    echo "<h1>Register</h1>";
    
    $submit = $_POST['submit'];
    
    $firstname = strip_tags($_POST['firstname']);
    $lastname = strip_tags($_POST['lastname']);
    $address = strip_tags($_POST['address']);
    $country = strip_tags($_POST['country']);
    $state/provence = strip_tags($_POST['state/provence']);
    $zipcode = strip_tags($_POST['zipcode']);
    $username = strtolower(strip_tags($_POST['username']));
    $password = strip_tags($_POST['password']);
    $repeatpassword = strip_tags($_POST['repeatpassword']);
    $date = date("y-m-d");
    
    
    if ($submit)
    {
    
    	$connect = mysql_connect("localhost","root","");
    	mysql_select_db("phplogin");
    
    	$namecheck = mysql_query("SELECT username FROM users WHERE username='$username'");
    	$count = mysql_num_rows($namecheck);
    
    	if ($count!=0)
    	{
    
    	die("Username already taken.");
    
    	}
    
    
    if ($firstname&&$lastname&&address&&country&&state/provence&&zipcode&&$username&&$password&&$repeatpassword)
    {
    	if ($password==$repeatpassword)
    	{
    	if (strlen($username)>25)
    	{
    	echo "Length of username is too long.";
    
    	}
    	else
    	{
    	if ( strlen($password) > 25 || strlen($password) < 6 )
        { 
    	echo "Password must be between 6 and 25 characters";
    	}
    	else
    	{
    		$password = md5($password);
    	$repeatpassword = md5($repeatpassword);
    
    	$queryreg = mysql_query("
    
    	INSERT INTO users VALUES ('','$firstname','$lastname','$address','$country','$state/provence','$zipcode','$username','$password','$date')
    
    ");
    
    die("You have been registered <a href='index.php'>Return to login page</a>");
    
    
    		}
    
    	}
    
    }
    	else
    		echo "Your passwords do not match";
    
    	
    }
    else
    	echo "Please fill in <b>all</b> fields.";
    
    }
    
    ?>
    <p>
    
    
    
    
    
    <html>
     <head>
    	<title>LinkedMail</title>
    	<link rel="stylesheet" type="text/css" href="Unrestricted.css">
    	
    	
    
     </head>
    
    <body>
    
    <table name="top" bgcolor=3399FF height=5% width=100%>
    	
    		<td align=right <font size=+4>LinkedMail</font></td>
    
    		<td align=right bgcolor=3399FF><form name="searchbox" action="http://www.google.com/cse?" method=get align=top>
    	<input type="textbox" name="q">
    	<input type="submit" value="Search"></form></td>
    </table>
    
    <form action='register.php' method='POST'>
    	<table name="Registration" bgcolor=white>
    <tr>
    	<td>
    	First Name:
    	</td>
    	<td>
    	<input type='text name='firstname' value='<?php echo $firstname; ?>'>
    	</td>
    	<td>
    	Last Name
    	</td>
    	<td>
    	<input type='text name='lastname' value='<?php echo $lastname; ?>'>
    	</td>
    </tr>
    <tr>
    	<td>
    	Address:
    	</td>
    	<td>
    	<input type='text' name='address' value='<?php echo $address; ?>'>
    	</td>
    </tr>
    <tr>	
    	<td>
    	Country:
    	</td>
    	<td>
    	<input type='text' name='country' value='<?php echo $country; ?>'>
    	</td>
    </tr>
    <tr>
    	<td>
    	Zip Code:
    	</td>
    	<td><input type='text' name='zipcode' value='<?php echo $zipcode; ?>'>
    	</td>
    </tr>
    
    </table>
    <br>
    <br>
    
    <table name="ID" bgcolor=white>
    
    <tr>
    	<td>
    	Prefered User Name:
    	</td>
    	<td><input type='text' name='username' value='<?php echo 	$username; ?>'>
    	</td>
    </tr>
    <tr>
    	<td>Create a Password</td>
    	<td>
    	<input type='password' name='password'>
    	</td>
    </tr>
    <tr>
    
    	<td>Retype Password</td>
    
    	<td><input type='password' name='repeatpassword'></td>
    </tr>
    <tr>
    	<td>Check to agree to <a href="Terms.html">Terms</a></td>
    	<td><input type="checkbox" name="agree"></td>
    </tr>
    <tr>
    	</table> 
    	<p>
    	<input type='submit' name='submit' value='Register'>
    
    </form>
    
    
    <table name="bottom" bgcolor=3399FF height=5% width=100%>
    	
    <tr>	
    
    	<td align=center><font color="white" align="right"><a href="ContactUs.html">Contact Us</a></td>
    
    	<td align=center><font color=white size=5>|</td>
    
    	<td align=center><font color="white" align="right"><a href="About.html">About</a></td>
    
    	<td align=center><font color=white size=5>|</td>
    
    	<td align=center><font color="white" align="right"><a href="Privacy.html">Privacy</a></td>
    
    	<td align=center><font color=white size=5>|</td>
    
    	<td align=center><font color="white" align="right"><a href="Terms.html">Terms</a></td>
    
    </tr>	
    
    
    </table>
    </body>
    </html>
    
     
  2. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #2
    The code,
    PHP:
    $state/provence
    is illegal. The / is not allowed, only alphanumeric characters and _ are allowed.
     
  3. JLEW700 thread starter macrumors 6502

    Joined:
    Aug 12, 2008

Share This Page