What exactly is missing?
You already know how to verify if the address is valid. If it is, insert it into the table (as you already know), if it doesn't, do something like this:
if (!valid) {
$error = "Invalid address.";
}
// and maybe in the html
<**php if ($error) { echo $error; } **>
// i changed ? to ** since cloudflare was blocking the code with the real php tag
An working example:
<**php
if (isset($_POST["address"])) {
$address = $_POST["address"];
if (checkAddress($address) {
addAddressToDb($address);
} else {
$error = "Invalid address.";
}
} else {
$error = "Please input an address.";
}
**>
Add Address
<**php if (isset($error)) { echo $error; } **>
// again, i changed ? to ** since cloudflare was blocking the code with the real php tag
And then, the
addAddressToDb($address) function simply receives the address as a parameter and add it to the database with the INSERT sql command.
Or something like this.