So, I have this code:
if (isset($_POST['Add']) and $_POST['What to insert']!="") {
$sql2="INSERT INTO $tbl_name (id, name, auftrag, bemerkungen) VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT)";
$result2=mysqli_query($link, $sql2);
}
What do I have to insert where I wrote ‘what to insert’ ?
‘Add’ is a input/submit button which should create blank rows for my sql table. However it does so every time I refresh the page which is not what I want.
I asked this question earlier in the stackoverflow forums but no one is answering me any longer. Does anybody have an idea? Do you need the whole code to answer? A member in the stackoverflow forum said:
Try this and in You Post Value pass your post array index.
if (isset($_POST['Add']) and $_POST['You_post_value']!="") {
$sql2="INSERT INTO $tbl_name (id, name, auftrag, bemerkungen) VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT)";
$result2=mysqli_query($link, $sql2);
}
Or
if (isset($_POST['You_post_value']) and $_POST['You_post_value']!="") {
$sql2="INSERT INTO $tbl_name (id, name, auftrag, bemerkungen) VALUES (DEFAULT, DEFAULT, DEFAULT, DEFAULT)";
$result2=mysqli_query($link, $sql2);
}
Note: And it should be your post value, Ignore button click.
This is what he answered. But I didn’t understand what he meant.
Thanks in advance.