Jump to content

Another, sigh, "unexpected end of file" error


SuiGenerisMN

Recommended Posts

I am sure to get some flack for this, but I have searched google, and this forum, and found some great advice, but I am still getting the "unexpected end of file" error.

 

Any assistance is appreciated.

 

Background, I have an HTML form that submits an email to me and I would also like to send the form data to a DB.

 

The emailform.php has the include ("loaddb.php"); at the top. The emailform.php works fine, but the data never gets entered into the DB.

<?php

$servername = “localhost”;
$username = “”;
$password = “”;
$dbname = “”;
$tblname = “”;

If (isset($_POST[‘submit’]))
	{
		$conn = mysqli_connect($servername, $username, $password);

		if (!$conn)
	{
		die('Could not connect: ' . mysqli_error());
	}
		mysqli_select_db($dbname, $conn);

		$first_name = $_POST['first_name'];
		$last_name = $_POST['last_name'];
		$email_from = $_POST['email'];
		$telephone = $_POST['telephone'];
		

		$first_name = mysqli_real_escape_string($first_name);
		$last_name = mysqli_real_escape_string($last_name);
		$email = mysqli_real_escape_string($email);
		$telephone = mysqli_real_escape_string($telephone);
		
	$query = "
	INSERT INTO $dbname.$tblname(‘ID’, ‘First’, ‘Last’, ‘Email’, ‘Phone’)
	VALUES (NULL, '$first_name', '$last_name', '$email', '$telephone');”;
        }

	mysqli_close($conn);

?>

I checked whitespace, all brackets appear to be closing. Error shows as last line with the closing "?>" and I am stumped.

 

Again, sorry for "another one of these error" questions but I just cannot get this to work and have been trying everything I can think of.

Link to comment
Share on other sites

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.