I've done it before but this time I dunno what's wrong!
Here is my PHP code:
if (isset($_POST['add_sub']) && !empty($_POST['add_sub'])) {
$word = $_POST['word'];
$phonetic = $_POST['phonetic'];
$meaning = $_POST['meaning'];
$engMeaning = $_POST['engMeaning'];
$example = $_POST['example'];
$eMeaning = $_POST['eMeaning'];
$sqlAdd = "INSERT INTO words (word,meaning,eng-meaning,example,example-meaning,phonetic)
VALUES ('$word','$meaning','$engMeaning','$example','$eMeaning','$phonetic')";
$db->query($sqlAdd);
header('location: index');
}
}
and here is my form:
<form action="index" method="post">
<input type="text" name="word" id="word" placeholder="Word" value="">
<input type="text" name="phonetic" id="phonetic" placeholder="Phonetic" value="">
<input type="text" name="meaning" id="meaning" placeholder="Meaning" value="">
<input type="text" name="engMeaning" id="endMeaning" placeholder="English Meaning" value="">
<textarea type="text" name="example" id="example" placeholder="Example" value="" rows="5"></textarea>
<textarea type="text" name="eMeaning" id="eMeaning" placeholder="Example Meaning" value="" rows="5"></textarea>
<button type="submit" name="add_sub">Add</button>
</form>
When I click on the submit button it just jumps back to the index page and nothing is added.
Is there anything that I can't see here?!
Update: I can get data from my DB with no problem, I just can't insert.