I have a contact form called contact.php3 and in the action field i have it sent to form.php3 which is:
<?php
header("Location: $frmRedirect");
?>
<?php
$mailprog = "/usr/sbin/sendmail -t";
?>
<?php
$fd = popen($mailprog,"w");
fputs($fd, "To: me@hotmail.com\n");
fputs($fd, "From: $frmName <$frmEmail>\n");
fputs($fd, "Subject: Customer Comments\n");
fputs($fd, "X-Mailer: php\n\n");
fputs($fd, "Name: $frmName\n");
fputs($fd, "Email: $frmEmail\n");
fputs($fd, "Show Email: $frmShowEmail\n");
fputs($fd, "Comments: $frmComments\n");
pclose($fd);
exit;
?>
i'm new to php, and would like to know if I can add an email validator: so someone must type in email@domain.com for it to work. if they just type in email it'll go to a page with an error.
I also want the script to make sure all fields are filled in. And if its possible, have a refer check so if someone peaks at the html and trys to use the form on their site, it won't work...
It must be sent from the doman I specify.
Please re-write the code for it to be able to do this.
Remember i'm new to php. If you don't mind, please comment on what you did and why you did this so I can learn it and help other people like you helped me.