A text input will always report a value in $_POST
, possibly an empty string.
Conceptually, you allow the user to add both values, so it's up to you to prioritize one over the other or report an error in case both are filled.
Now to detect automatically which one was filled, you could simply test the value of the $_POST
data.
if ($_POST['add'] != "" && $_POST['web'] != "") {
error ("make up your mind!");
}
if ($_POST['add'] != "") { ....
if ($_POST['web'] != "") { ....