Looking for way to prevent the submission of fields containing certain domains or strings from being accepted into form that sends the data to database.
Searches all send me to strpos.
Can produce a message but not stop the form from submitting when selected URL or string is in field.
Below is form entry box using email field as example:
<input type="email" name="email" required >
A variable is made from the post.
<?php
$email = test_input($_POST["email"]);
?>
I can get it to give a message by using this code:
<?php
if ($email contains "selected.domain")
echo "email address cannot be this domain";
?>
but need it to prevent submission if email address contains "selected.domain", or any specified string.
Not a programmer but . . . .
This is the type of form:
<form name="submissionsform" action="" method="post" >
This is the email input and Event URL input box. Both need to have certain domains restricted. That's the issue. Tried the strpos code but so far can't get it to work as needed. These are already required fields, just need to add the exemption for certain domains or strings. Hopefully this makes more sense.
<center>Your email:<br><input type="email" name="email" style=" border-radius:5px; width:90%; height:25px" required></center>
<center>Event Link - IMPORTANT:<br><input type="url" name="link" value="" style=" border-radius:5px; width:95%; height:25px" required></center>
The Submit button:
<center> <button style=" border-radius:5px; background-color:transparent; width:100%" name="save_event_data">Submit</button></center>