PDA

View Full Version : PHP & JavaScript Assignment Help Please!



airjonny22
26 Oct 2009, 02:02 PM
Hey guys, I have an assignment due Wednesday for my Website Development class. This week is PHP & JavaScript and I am having some difficulties. If someone could please help me get through this assignment I would greatly appreciate it!

I made a website about myself and the link is www.JonathanPalmieri.info. It is a very simple website as of now and still needs touching up, but this weeks assignment is to add a contact form to the website. I am working in Microsoft Expression Web 2.0. I made the contact form and have uploaded it to my site. This weeks assignment is:

Add a Contact Us section to your site:
Nicely formatted form that requires:
First Name
Last Name
Phone Number
State (use a drop down)
E-mail
It requests:
Address
City
Zip
Error checking for required information
Error checking for data type, size, and basic format
On the form processing page:
Show today's date
If the visitor is from NJ indicate that you will get back to them in 2 days (show that date)
If the visitor is from NY indicate that you will get back to them in 3 days (show that date)
If the visitor is from any other state indicate that you will get back to them in 1 week (show the exact date)
Echo back the users first and last name.
For example, my results page might be something like:

Ross Malaga thank you for contacting us. Since you live in NJ someone will get back to you within 2 days. Today is Sept. 1, 2009 so expect a response from us by Sept. 3, 2009.

In addition to creating the Contact Us page create a directory called a4 on your site and upload the page there as well. So mine would be www.rossmalaga.com/a4.

Zip all files and submit them.


I am lost when it gets to error checking. In his examples he made a calculator which didnt help me in figuring out how to make a alert box pop up when required fields are not filled out or tell me how to do the responses with states.

If anyone could please take the time to help me I would greatly appreciate it! Thanks Guys!

airjonny22
26 Oct 2009, 03:48 PM
my code for my PHP page currently looks like this:

<?php

$FirstName= $_POST['FirstName'];
$LastName= $_POST['LastName'];
$Address= $_POST['Address'];
$City= $_POST['City'];
$State= $_POST['State'];
$Zip= $_POST['Zip'];
$EmailAddress= $_POST['EmailAddress'];
$PhoneNumber= $_POST['PhoneNumber'];
$error="";



if($FirstName=="") $error.="*Please enter a First Name"."<br>";
if($LastName=="") $error.="*Please enter a Last Name"."<br>";
if($PhoneNumber=="") $error.="*Please enter a Phone Number"."<br>";
if($State=="") $error.="*Please chose a state"."<br>";
if($EmailAddress=="") $error.="*Please enter a valid email address"."<br>";


?>


however, nothing happens when i click my submit button still