This blog is about Graphic Design, Vector Art, and Cartoon Illustration

Troubleshooting your contact form and its php script

To make a contact page function, you must have cooperation between the HTML page and the php page. If your contact page doesn't seem to be working, here are some things to check right away.

• Be sure that that the contact form that you created in Dreamweaver is actually a form. This means to be sure that you are using the form tag. The form tag allows you to create an action. Be sure that the action is to POST to the php page that you uploaded. Uh, you did upload the php page, didn't you? I named mine contact_form.php, but you can name it anything as long as it ends in .php.

• Be sure that you have named your text fields in your form. That will tell your php script what to look at. The name of the game here is cooperation! In the php script you must use the same names in the string.

• Go check your php file. Here is a typical string - $email_field = $_POST['email']; - note that between the brackets is the word 'email' - that must match what you called the text field on your contact page form in Dreamweaver. The php script that you found on the web and copied probably won't have the same names that you used on your Dreamweaver page. Fix 'em!

• To get the information to show up in the email that you receive when someone uses your contact page you must use this string - $body = "Name: $name_field\n Email: $email_field\n Phone number: $phone_field\n Message:\n $message"; - this is telling php what will appear in the body of your email. Note that when you include $email_field, the php goes and gets the email that was typed into your contact page and puts it in the body of the email that you receive.

Pretty cool, isn't it?