I'm having issues entering data from a php form on my local host into MySQL. I will post the code below.
$zip = $_POST['zip'];
$city = $_POST['city'];
$sql = "INSERT INTO zipcodes (zip, city) VALUES ('$zip', '$city')";
if (mysqli_query($con,$sql))
{
echo "Order Details DB Updated successfully";
}
else
{
echo "Error creating database: " . mysqli_error($con);
}
I have $con declared above, and the connection works.
It shows that I connect to my DB correctly, but it just isn't entering the correct data that I type into the form. I'm not sure why it wouldn't enter when I have the correct connection. Any help would be appreciated. Thank you!