Jump to content

bennetta89

New Members
  • Posts

    3
  • Joined

  • Last visited

bennetta89's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks so much both of you all! I think it is fixed now!!! Your feedback was awesome!!!
  2. Thanks for your feedback @SocialCloud ! I tried removing the extra "(" so that the corrected lined was: if ( !empty($_POST['name'])) However, I was still receiving the same error message when I tried to run the code. I also tried: if (!(empty($_POST['name']))) Because I thought that maybe I might be missing an extra ")" at the end of that line, but that was giving me the same error as well. Do you see anything else that may be causing it? I really appreciate all of your help.
  3. 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); ?>
×
×
  • 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.