Hi everyone,
I am fairly new to PHP coding, and I am attempting to write a script that reads entries from a contact entry from and adds them to a database. However I keep receiving an error that states:
" Parse error: syntax error, unexpected 'name' (T_STRING), expecting ']' in C:\wamp\www\it665\addContact.php on line 16"
I have been trying to figure out what I am missing, or need to remove, and I am having the hardest time. Below is the entire code for the addContact.php script that I keep receiving this error for. I would really appreciate any feedback.
<?php
$connection = mysql_connect('localhost', 'root', '');
$db = mysqli_connect('localhost','root', '' ,'mycontacts');
if(isset($_POST['submit']))
{
$name = $_POST['name'];
$address = $_POST['address'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$phone = $_POST['phone"];
if (!(empty($_POST['name']))
{
$query = "insert into contacts (contact_name, contact_address, contact_city, contact_state,
contact_zip_code, contact_phones) ";
$query .= " VALUES ( '".$name."' , '".$address."' , '".$city."' , '".$state."' , '".$zip."' ,
'".$phone."');";
echo "<br/><br/><span>Data Inserted successfully...!!</span>";
}
else{
echo "<p>Insertion Failed <br/> Some Fields are Blank....!!</p>";
}
}
mysql_close($connection);
?>