Jump to content

Parse error: syntax error, unexpected $end


genzedu777

Recommended Posts

Hi guys

 

I need some help in my coding, I have received this error "Parse error: syntax error, unexpected $end in D:\inetpub\vhosts\championtutor.com\httpdocs\9.2_wilson.php on line 218"

 

This error is referring to my last line, right after </html>, I don't really understand what it means, can someone explain the definition of the error to me?

 

Thanks

 

<style type="text/css">

/* *** Reset browser styles *** */
table {
border-collapse: collapse; /* prevents do .!doctype'p /uble borders */
border-spacing: 0;
}

td, th, caption {
font-weight: normal;
text-align: left;
}

img, fieldset  { 
border: 0; /* remove border around linked images and fieldsets */
}

ol  {
margin-left: 1.8em; /* add smaller indent than default */
list-style: decimal;
}

ul {
margin-left: 1.5em;
list-style:square;
}

q:before, q:after { 
content:''; /* remove browser generated quote marks */
}

body {
font-size: 62.5%;
font-family: Trebuchet MS, Arial, Helvetica, sans-serif;
color: #383838;
}

#contentWrap {
width: 940px;
margin-right: auto;
margin-left: auto;
}
</style>

<script type="text/javascript">
$(document).ready(function() {
$('#signup').validate({
	//creating an empty object
	rules: {
		email: {
			required: true,
			email: true
		},
		password: {
			required: true,
			rangelength: [8,16]
		},
		confirm_password: {
			equalTo: '#password'
		},
		spam: "required"
	}, //end rules
	messages: {
		email: {
			required: "Please supply your e-mail address.",
			email: "This is not a valid e-mail address."
		},
		password: {
			required: 'Please type a password',
			rangelength: 'Password must be between 8 and 16 characters long.'
		},
		confirm_password: {
			equalTo: 'The two passwords do not match.'
		}
	}, //end messages
	errorPlacement: function(error, element) {
		if (element.is(":radio") || element.is(":checkbox")) {
			error.appendTo(element.parent());
		}
		else {
			error.insertAfter(element);
		}
	} //end errorPlacement

}); //end of validate()
}); // end ready()
</script>

<?php
  require_once('123.php');

  // Connect to the database
  $dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

  if (isset($_POST['submit'])) {
    // Grab the profile data from the POST
    $name = mysqli_real_escape_string($dbc, trim($_POST['name']));
$email = mysqli_real_escape_string($dbc, trim($_POST['email']));
    $password = mysqli_real_escape_string($dbc, trim($_POST['password']));
    $password_confirm = mysqli_real_escape_string($dbc, trim($_POST['password_confirm']));
$location = $_POST['location'];
$dob = $_POST['dob'];
$category = $_POST['category'];

   
        $query = "INSERT INTO practice_user (name, email, password, location, dob, category, join_date) VALUES ('$name, $email', SHA('$password'), $location, $dob, $category, NOW())";
        mysqli_query($dbc, $query)
	or die(mysql_error());

        // Confirm success with the user
        echo '<p>Your new account has been successfully created. You\'re now ready to <a href="login.php">log in</a>.</p>';

        mysqli_close($dbc);

?>

</head>
<body id="twoCol">
<div id="container">
  
  
  <div id="contentWrap">
  <div id="main">
  <h1>Signup Form  </h1>
  <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="signup" id="signup"> 
    <div>
      <label for="name" class="label">Name </label>
      <!--Basic Validation Method-->
  <input name="name" type="text" id="name" class="required" title="Please type your name.">
    </div>
    <div>
      <label for="email" class="label">E-mail Address</label>
      <input name="email" type="text" id="email">
    </div>
    <div>
      <label for="password" class="label">Password</label>
      <input name="password" type="password" id="password">
    </div>
    <div>
      <label for="confirm_password" class="label">Confirm Password</label>
      <input name="confirm_password" type="password" id="confirm_password">
    </div>
<div>
<span class="label">Location</span>

      <input name="location" type="checkbox" id="yishun" value="yishun" class="required" title="Please check at least 1 location.">
      <label for="yishun">Yishun</label>
  
      <input name="location" type="checkbox" id="angMoKio" value="angMoKio">
      <label for="angMoKio">Ang Mo Kio</label>
  
      <input name="location" type="checkbox" id="yioChuKang" value="yioChuKang">
      <label for="yioChuKang">Yio Chu Kang</label>
  
    </div>
    <div>
      <label for="dob" class="label">Date of birth</label>
      <input name="dob" type="text" id="dob" class="date required" title="Please type your date of birth using this format: DD/MM/YYYY">
    </div>
    <div>
      <label for="category" class="label">Category</label>
      <select name="category" id="category" class="required" title="Please choose a category.">
        <option value="">--Please select one--</option>
        <option value="undergraduate">Undergraduate</option>
        <option value="graduate">Graduate</option>
        <option value="master">Master Degree</option>
        <option value="phd">PhD</option>
      </select>
    </div>
    <div>
      <label for="comments" class="label">Comments</label>
      <textarea name="comments" cols="15" rows="5" id="comments"></textarea>
    </div>
    <div class="labelBlock">Would you like to receive annoying e-mail from us?</div>
    <div class="indent">
      <input  type="radio" name="spam" id="yes" value="yes" class="required" title="Please select an option">
      <label for="yes">Yes</label>
      <input type="radio" name="spam" id="definitely" value="definitely">
      <label for="definitely">Definitely</label>
      <input type="radio" name="spam" id="choice" value="choice">
      <label for="choice">Do I have a choice?</label>
     </div>
<div>
            <input type="submit" name="submit" id="submit" value="Submit">
    </div>
  </form>
</div>
  

</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/214435-parse-error-syntax-error-unexpected-end/
Share on other sites

I second the above. Also, you echo a "success" message to the user without doing anything to verify the query actually inserted anything. You should check for errors, then verify the record was inserted with mysqli_affected_rows().

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.