Jump to content

Another, sigh, "unexpected end of file" error


SuiGenerisMN
Go to solution Solved by kicken,

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.