I have tried to post values into database, it worked in database like a new row added, but not the values. First of all, I have put HTML like this:
<form action="config/testimonyAction.php">
<p> <input type="text" name="name" placeholder="name" /> </p>
<p> <input type="text" name="testimony" placeholder="testimony" /> </p>
<p> <input type="submit" value="SEND"> </p>
</form>
And the action will go to testimonyAction.php. The following code are below:
<?php
include ('dbconnect.php');
$name = $_POST['name'];
$testimony = $_POST['testimony'];
$sql = "INSERT INTO testimonial (name, testimonial) VALUES ('$name', '$testimony')";
if (mysqli_query($mysqli, $sql)) {
header('Location: http://www.test.com/');
exit;
}
else
{
echo "Error: " . $sql . "<br>" . mysqli_error($sql);
}
mysqli_close($mysqli);
?>
In the end, it confused me. It should be working but the values that we input doesn't appear in database? Any idea?