I am trying to insert data from a form to mySQL DB, no connection error, but no data is inserted into my database. Any idea? Here's my HTML form:
PHP Form =
The submit button name is not always sent with the rest of the form data AFAICR. Try switching isset($_POST['simpan']) to $_SERVER['REQUEST_METHOD'] == 'post'. The other option is to output $_POST before the if statement and make sure it contains what you think it contains.
$_SERVER['REQUEST_METHOD'] == 'post'
Meanwhile, use mysqli_error to find see what error prevented the data from being stored (instead of just saying "Data Not Stored").
And for code that is intended for use in the real world, do not embed user-supplied data directly into database commands.
Weedpacket And for code that is intended for use in the real world, do not embed user-supplied data directly into database commands.
As Weedpacket points out, if you put user-supplied data directly into your SQL commands, you run the risk of SQL injection.
sneakyimp Hi buddy, what can be the best way to cover that loop?
Ruben E Robertson