0

I am currently using the code shown below; however it isn't uploading the data from the application. If I select the page that the file is hosted on, it would add an empty record into the database. I am being led to think that the problem is with the Posting code. Can anyone help me out with this situation please?

<?php
    $mysqli = new mysqli('','','',''); 
    $query = $mysqli->query("INSERT INTO citizen(cFName, cLName, cStreet, cCity, 
                    cCountry, email, cDob, cGender, cHeight, maritalStatus, 
                    placeOfBirth, idNumber, contactNumber, workNumber) 
                VALUES('$_POST[cFName]', '$_POST[cLName]', '$_POST[cStreet]', '$_POST[cCity]',
                   '$_POST[cCountry]', '$_POST[email]', '$_POST[cDob]', '$_POST[cGender]', 
                   '$_POST[cHeight]', '$_POST[maritalStatus]', '$_POST[placeOfBirth]', 
                   '$_POST[idNumber]', '$_POST[contactNumber]', '$_POST[workNumber]')");

?>
Dijkgraaf
  • 11,049
  • 17
  • 42
  • 54
  • Try `$mysqli->commit()` : The last question on SO had this as the issue. And posting username/pwds on public pages is not a good idea. – TJ- Nov 10 '14 at 19:24
  • Try checking for an error using [mysqli error](http://php.net/manual/en/mysqli.error.php). You may also try printing your query to see if it's what you would expect.You should also make sure you [protect yourself against mysql-injection](http://stackoverflow.com/questions/60174/how-can-i-prevent-sql-injection-in-php). – iLot Nov 10 '14 at 23:30
  • I tried that but it outputs this error "Warning: mysqli::commit() expects exactly 0 parameters". – user3498995 Nov 11 '14 at 03:22

0 Answers0