i m newbie 2 PHP & to b frank ... will alwaz be ... i dont think i will go into much details with PHP as my work doesnot include workin with PHP
bt i have a forum .. and i want to make a personal contact page in it .... and save all details in my new database....
i have website in the root folder
i get dis error
Parse error: parse error, unexpected T_VARIABLE in C:\wamp\www\hukumnama\contact.php on line 120
Error on saving to database & also in mailing
<html>
<head>
</head>
<body>
<?php
/* grabs the POST variables and puts them into variables that we can use */
$firstName=$_POST['firstName'];
$lastName=$_POST['lastName'];
$company=$_POST['company'];
$email=$_POST['email'];
$website=$_POST['website'];
$countryCode=$_POST['countryCode'];
$phone=$_POST['phone'];
$phoneExt=$_POST['phoneExt'];
$mobile=$_POST['mobile'];
$fax=$_POST['fax'];
$address=$_POST['address'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$zipCode=$_POST['zipCode'];
$heardAbout=$_POST['heardAbout'];
$inquiring=$_POST['inquiring'];
//---------VALIDATION-------->
if($firstName){//----> CHECK input
}
else{
$error.="Please, go back and fill out your first name<br>\n";//----> ERROR if no input
}
if($lastName){//----> CHECK input
}
else{
$error.="Please, go back and fill out your last name<br>\n";//----> ERROR if no input
}
if($email){//----> CHECK input
}
else{
$error.="Please, go back and fill out your e-mail address<br>\n";//----> ERROR if no input
}
if($phone){//----> CHECK input
}
else{
$error.="Please, go back and fill out your phone number<br>\n";//----> ERROR if no input
}
if($address){//----> CHECK input
}
else{
$error.="Please, go back and fill out your mailing address<br>\n";//----> ERROR if no input
}
if($city){//----> CHECK input
}
else{
$error.="Please, go back and fill out your city name<br>\n";//----> ERROR if no input
}
if($zipCode){//----> CHECK input
}
else{
$error.="Please, go back and fill out your zip code<br>\n";//----> ERROR if no input
}
//-------->ERROR FREE??
if($error==""){
echo "Thank you for inquiring about us! A receipt of your submission will be e-mailed to you almost immediately.";
//----------------------------------
$mailContent="--------CONTACT--------\n"
."First Name: ".$firstName."\n"
."Last Name: ".$lastName."\n"
."Company: ".$company."\n"
."E-mail: ".$email."\n"
."Website: ".$website."\n\n--------PHONE--------\n"
."Phone: ".$countryCode." ".$phone."\n"
."Extension: ".$phoneExt."\n"
."Fax: ".$fax."\n"
."Mobile: ".$mobile."\n\n--------ADDRESS--------\n"
."Street Address: ".$address."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Country: ".$country."\n"
."Zip Code: ".$zipCode."\n\n--------INFO--------\n"
."Where did you hear about us? ".$heardAbout."\n"
."Inquiring about: ".$inquiring."\n"
//----------------------------------
$toAddress="mail2me@mailme.com"; /* change this! */
$subject="MyWebSite.com's Products"; /* change this! */
$recipientSubject="MyWebSite.com's Contact Form"; /* change this! */
$receiptMessage = "Thank you ".$firstName." for inquiring about MyWebSite.com's Products!\n\n\nHere is what you submitted to us:\n\n"
// ."--------CONTACT--------\n"
."First Name: ".$firstName."\n"
."Last Name: ".$lastName."\n"
."Company: ".$company."\n"
."E-mail: ".$email."\n"
."Website: ".$website."\n\n--------PHONE--------\n"
."Phone: ".$countryCode." ".$phone."\n"
."Extension: ".$phoneExt."\n"
."Fax: ".$fax."\n"
."Mobile: ".$mobile."\n\n--------ADDRESS--------\n"
."Street Address: ".$address."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Country: ".$country."\n"
."Zip Code: ".$zipCode."\n\n--------INFO--------\n"
."Where did you hear about us? ".$heardAbout."\n"
."Inquiring about: ".$inquiring."\n"
//----------------------------------
mail($email, $subject, $receiptMessage,"From:$toAddress");
//----------------------------------
mail($toAddress,$recipientSubject,$mailContent,"Fr om:$email");
--->echo $mailContent;
//////////////////////////////////////// CONNECT TO MYSQL DB ////////////////////
// OPEN CONNECTION --->
$connection=mysql_connect("localhost","root", "") or die("Unable to connect!"); /* change this! */
mysql_select_db("hukumnama_contact") or die("Unable to select database!"); /* change this! */
// EXECUTE QUERY --->
$query="INSERT INTO generalContact (
firstName,
lastName,
company,
email,
website,
countryCode,
phone,
phoneExt,
mobile,
fax,
address,
city,
state,
country,
zipCode,
heardAbout,
inquiringOn)
VALUES(
'".$firstName."',
'".$lastName."',
'".$company."',
'".$email."',
'".$website."',
'".$countryCode."',
'".$phone."',
'".$phoneExt."',
'".$mobile."',
'".$fax."',
'".$address."',
'".$city."',
'".$state."',
'".$country."',
'".$zipCode."',
'".$heardAbout."',
'".$inquiring."')";
//////----->
$result=mysql_query($query) or die("Error in query:".mysql_error());
//if ($result)
//echo mysql_affected_rows()." row inserted into the database effectively.";
// CLOSE CONNECTION --->
mysql_close($connection);
///////////////////////////////////////////////////////////////////////////////////
}
else{
print "Sorry, but the form cannot be sent until the fields indicated are filled out completely - <br>\n";
print "$error<br>\n";
print "<br>\n";
print "<br>\n";
print "Please use your \"Back\" button to return to the form to correct the omissions. Thank you.<br>\n";
}
?>
</body>
</html>
can anyone help me out ......
thnks .....