I want to start by saying i tried atleast 10 different solutions on this site, but none worked in my case so i was wondering if you guys could help me figure out what's wrong.
Form:
<form align="center" action=includes/signup.php method="post">
<input type="text" id="fname" name="fname" placeholder="First Name"><br>
<input type="text" id="lname" name="lname" placeholder="Last Name"><br>
<input type="text" id="uname" name="uname" placeholder="Username"><br>
<input type="text" id="email" name="email" placeholder="Email"><br>
<input type="text" id="phone" name="phone" placeholder="Phone Number"><br>
<button type="submit" value="submit" name="submit" name="save"> Add To Database </button>
</form>
signup.php
<?php
include_once 'dbh.php';
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$uname = $_POST['uname'];
$email = $_POST['email'];
$phone = $_POST['phone_no'];
$sql = "INSERT INTO `users` (f_name, l_name, username, email, phone_no)
VALUES ('$fname', '$lname', '$uname', '$email', '$phone');";
if (!mysqli_query($conn, $sql)) {
echo 'Not Inserted';
} else {
echo 'inserted';
}
header("refresh:3; url=../index.php?add=success");
My problem is that everytime i press the button, i get "Not Inserted", but when i changed the values from "$fname" to "David", David got inserted into the database. Which means the data from the form is not being received by this page.
I am using VS Code incase that makes a difference.