POST SUCCESS BUT NO DATA IN DB
Hi guys, please assist me, I am posting to the database from my website and the success message and page is showing, however when I look into the database nothing shows, what could be the matter!?
Hi guys, please assist me, I am posting to the database from my website and the success message and page is showing, however when I look into the database nothing shows, what could be the matter!?
which line of code exactly if i may ask?
I'm not providing all of the solution but a streamlined one so you get the idea when using mysqli (I've set down to 'eMail' in the $_POST[] array list).
1. Add the name attribute 'insert' to your form button:
<input type="submit" name="insert" value="Insert">
2. Connect to your database: (use your connection details):
<?php $conn = new mysqli('hostServerName' , 'username' , 'password' , 'databaseName');?>
3. Insert the form data into your database.
<?php
// Insert form data IF the form submit button with the name of 'insert' is clicked
if(isset($_POST['insert'])) {
$MemberID = $conn->real_escape_string($_POST['whatever2']);
$title = $conn->real_escape_string($_POST['Title']);
$fname = $conn->real_escape_string($_POST['FName']);
$lname = $conn->real_escape_string($_POST['LName']);
$identityNumber = $conn->real_escape_string($_POST['Identity_Number']);
$dateOfBirth = $conn->real_escape_string($_POST['Date_Of_Birth']);
$nationality = $conn->real_escape_string($_POST['Nationality']);
$citizenship = $conn->real_escape_string($_POST['Citizenship']);
$cell = $conn->real_escape_string($_POST['Cell']);
$eMail = $conn->real_escape_string($_POST['eMail]);
$conn->query("INSERT INTO borrower
(Member_Id, Title, FName, LName, Identity_Number, Date_Of_Birth, Nationality, Citizenship, Cell, eMail)
VALUES
('$MemberID', '$title', '$fname', '$lname', '$identityNumber', '$dateOfBirth', '$nationality', '$citizenship', '$cell', '$eMail')
");
$insertSuccessful = 'true';
}
if(isset($insertSuccessful)) {
header("Location: to.php?whatever2= $MemberID");
}
?>
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.