Jump to content

[SOLVED] PHP register code errors


rocket01

Recommended Posts

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

 

 

Link to comment
https://forums.phpfreaks.com/topic/179833-solved-php-register-code-errors/
Share on other sites

$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).

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.