...

View Full Version : Format my Forms?



JAZZASTUDIOS
07-05-2007, 12:44 AM
hey guys
i was wandering (i cant script for poo)
i got my friend to make some simple forms for my webstie contact section (www.jazzastudios.com/contact.html) and when i get emails from those forms they end up like this:
http://img487.imageshack.us/img487/4168/untitled6gv5.jpg

worse still, lately i've been getting porn-spam. Not good.

How do i format the forms so the email and name and subject, appear where they should, in the header thing?

how do i make it so people HAVE to enter an email adress in the email adress bit?

How to i stop spambots and pornlinks?

TheShaner
07-05-2007, 03:22 PM
The sent.php script that your form is submitting to needs to be redone. Apparently your friend just sent you the unformatted output he collected from the form. Just have him redo the PHP email function he must've created with the required formatting and email address checking you need. He should know how. If not, then we'll need to see the code of sent.php so that we can tell you how to modify it (of course, if you post the code, make sure you edit out any personal information).

-Shane

redoc
07-05-2007, 03:48 PM
To make an email address required, you just need to check it in the sent.php page to make sure it is valid. A simple way to make sure it was filled out would be:



if(empty($_POST['textfield222'])){
//display error message
}
else{
//mail the form here
}

However, you can get more advanced to make sure that the email address entered is actually valid. For example, the following uses regular expressions to make sure the email is proper:


if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $_POST['textfield222'])) {
//mail form here
}
else {
//email is not valid, display error
}

TheShaner is corrrect that you need to re-do the mail function. It should be pretty easy, it is just a matter of creating a string for the body, and formatting it with the variables the way you want. For more information go to:
http://php.codeislogic.com/howto-submit-a-form-via-email/

As for stopping spam, it is more difficult. I'd say fix the other problems first, then if you feel up to it, search for 'CAPTCHA'.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum