- Mar 22, 2013
- 9,145
- 10,489
I have this form on this website where people can input email and link. It has 2 fields, one for email one for link/URL.
The form prevents people from submitting the form if email is not written correctly, but they can submit it if they enter any text in the URL field. I'd like to make the form prevent the form from being submitted unless there's an actual URL submitted (require "http" present for successful submission would do it).
Anyway, here is the code that blocks submission if email is not present:
I've had this website for 5+ years, but recently some asshole started submitted 2-4 times per day, with random emails, and with random text in the URL field. Not sure why he persists, but it's been over a month now and it keeps happening and it's getting on my nerves receiving these emails.
Anyway, if anyone can whip up some magic in the code to require "http" present for successful form submission, I'd appreciate it.
Thank you
The form prevents people from submitting the form if email is not written correctly, but they can submit it if they enter any text in the URL field. I'd like to make the form prevent the form from being submitted unless there's an actual URL submitted (require "http" present for successful submission would do it).
Anyway, here is the code that blocks submission if email is not present:
PHP:
if(!$_POST) exit;
$email = $_POST['Email_Address'];
$error ="";
$errors ="";
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
$error.="Invalid email address entered!";
$errors=1;
}
if($errors==1) echo $error;
else{
$values = array ('Full_Name','Email_Address','Your_Link');
$required = array('Full_Name','Email_Address','Your_Link');
I've had this website for 5+ years, but recently some asshole started submitted 2-4 times per day, with random emails, and with random text in the URL field. Not sure why he persists, but it's been over a month now and it keeps happening and it's getting on my nerves receiving these emails.
Anyway, if anyone can whip up some magic in the code to require "http" present for successful form submission, I'd appreciate it.
Thank you