View Full Version : Format my Forms?

07-05-2007, 01: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:

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?

07-05-2007, 04: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).


07-05-2007, 04: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:

//display error message
//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:

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'.