rocket01 Posted November 1, 2009 Share Posted November 1, 2009 Ladies and Gentlemen, Wondering if anyone could help solve my problem, I am getting the following error; Parse error: syntax error, unexpected $end in C:\xampp\htdocs\Briton Ferry RFC\register.php on line 126 The code is as follows: <?php $submit = $_POST['submit']; //form data $name = strip_tags($_POST['name']); $surname = strip_tags($_POST['surname']); $email = strip_tags($_POST['email']); $username = strip_tags($_POST['username']); $password = strip_tags($_POST['password']); $confirmpassword = strip_tags($_POST['confirmpassword']); $date = date("y-m-d"); if ($submit); { //check for existance if($name&&$surname&&$email&&$username&&$password&&$confirmpassword) { //encrypt password $password = md5($password); $confirmpassword = md5($confirmpassword); if ($password==$confirmpassword); { //check char length of username and name if (strlen($username)>25||strlen($name)>25) { echo "maximum length of Username/Name are 25 characters"; } else { //check password length if (strlen($password)>25||strlen($password)<25) { echo "Password must be between 6 and 25 characters!"; } else { //register the user } if ($password==$confirmpassword); echo "Passwords do not match!"; } } ?> <html> <link href="bfrfc_css.css" rel="stylesheet" type="text/css"> <form action='register.php' method='POST'> <table> <tr class="text"> <td class="content"> <div align="left"><span class="text">Name: </span></div></td> <td> <input type='text' name='name'> </td> </tr> <tr> <td class="text"> Surname: </td> <td> <span class="text"> <input type='text' name='Surname'> </span></td> </tr> <tr> <td class="text"> Email Address: </td> <td> <span class="text"> <input type='text' name='email'> </span></td> </tr> <tr> <td class="text"> Username: </td> <td> <span class="text"> <input type='text' name='username'> </span></td> </tr> <tr> <td class="text"> Password: </td> <td> <span class="text"> <input type='password' name='password'> </span></td> </tr> <tr> <td class="text"> Confirm Password: </td> <td> <span class="text"> <input type='password' name='confirmpassword'> </span></td> </tr> </table> <p> <input type='submit' name='submit' value='Register'> </form> <span class="text"> <html /> </span> </html> PS the line containing the error is in red, however I cannot understand why the error is occurring here. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/ Share on other sites More sharing options...
Alex Posted November 1, 2009 Share Posted November 1, 2009 $end errors are almost always caused by forgetting a bracket. In your case you're missing 2 brackets that you need to add to the end of your PHP. Both of these statements aren't be closed: if ($submit); { //check for existance if($name&&$surname&&$email&&$username&&$password&&$confirmpassword) { And for the future make sure you use [ php ] or [ code ] tags (without the spaces). Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948714 Share on other sites More sharing options...
rocket01 Posted November 1, 2009 Author Share Posted November 1, 2009 Thanks for the reply, however I'm confused by firstly, which brackets are missing, and secondly, what do you mean by without the spaces? Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948718 Share on other sites More sharing options...
jefffan24 Posted November 1, 2009 Share Posted November 1, 2009 When he says use those without the spaces he means like: [code=php:0]put your code here [/code] and then you put code were it says "put your code here". Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948723 Share on other sites More sharing options...
Alex Posted November 1, 2009 Share Posted November 1, 2009 I showed you which brackets weren't being closed. To solve your problem simply put 2 more right curly brackets before ?> Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948724 Share on other sites More sharing options...
rocket01 Posted November 1, 2009 Author Share Posted November 1, 2009 } } ?> You mean these brackets? Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948727 Share on other sites More sharing options...
rocket01 Posted November 1, 2009 Author Share Posted November 1, 2009 problem solved now thanks for the help/advice guys. Quote Link to comment https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/#findComment-948731 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.