PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 30th, 2005, 02:08 PM
moggi1964 moggi1964 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 12 moggi1964 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 48 sec
Reputation Power: 0
Unhappy Parse error confusing a newbie.

and when I say newbie I trully mean it!.

So, I have created an HTML form in Dreamweaver MX and used a free script to create commands in PHP. The idea behind the form is that the person enters their details and submits, the data goes to my MYSQL database and emails are sent to me and the person.

I get the following error:

Parse error: parse error, enexpected T_VARIABLE in home/icoachda/public_html ContactMe.php line 88.

I have included the whole script below and highlighted line 88.

I have done a lot of searching on the net for a solution before posting here so you are more of a last stop than a first.

If I am presenting the data incorrectly I apologise.

Moggi1964


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>contact me</title>
<html>
<head>
</head>
<body>
<?php
/* grabs the POST variables and puts them into variables that we can use */
$Title=$_POST['Title'];
$firstname=$_POST['First Name'];
$PreferredName=$_POST['Preferred Name'];
$surname=$_POST['Surname'];
$Email=$_POST['Email'];
$street=$_POST['Street'];
$ApartmentNo=$_POST['Apartment Number'];
$city=$_POST['City'];
$state=$_POST['State'];
$ZipCode=$_POST['Zipcode'];
$country=$_POST['Country'];
$daytimetel=$_POST['Daytime telephone'];
$cancallday=$_POST['Can call in day'];
$eveningtel=$_POST['Evening telephone'];
$cancallevenin=$_POST['Can call evening'];
$OneThing=$_POST['One Thing'];
//---------VALIDATION-------->
if($Title){//----> CHECK input
}
else{
$error.="Please, go back and fill out your title\n";//----> ERROR if no input
}
if($firstname){//----> CHECK input
}
else{
$error.="Please, go back and fill out your first name\n";//----> ERROR if no input
}
if(PreferredName){//----> CHECK input
}
else{
$error.="Please, go back and fill out your preferred name\n";//----> ERROR if no input
}
if($surname){//----> CHECK input
}
else{
$error.="Please, go back and fill out your surname\n";//----> ERROR if no input
}
if($Email){//----> CHECK input
}
else{
$error.="Please, go back and fill out your email\n";//----> ERROR if no input
}
if($street){//----> CHECK input
}
else{
$error.="Please, go back and fill out your street name\n";//----> ERROR if no input
}
//-------->ERROR FREE??
if($error==""){
echo "Thank you for inquiring about icoachdads! A receipt of your submission will be e-mailed to you almost immediately.";
//----------------------------------
$mailContent="--------CONTACT--------\n"
."Title: ".$Title."\n"
."First Name: ".$firstName."\n"
."Preferred Name: ".$lPreferedName."\n"
."Surname: ".$surname."\n"
."E-mail: ".$Email."\n"
."Street: ".$street."\n\n--------ADDRESS--------\n"
."Apartment Number: ".$ApartmentNo."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$ZipCode."\n"
."Country: ".$couontry."\n"
."Daytime telephone: ".$dattimetel."\n\n--------PHONE--------\n"
."Can call in daytime: ".$cancallday."\n"
."Evening telephone: ".$eveningtel."\n"
."Can call in evening: ".$cancallevenin."\n"
."One thing: ".$OneThing."\n"
//----------------------------------
$toAddress="forms@icoachdads.com";
$subject="icoachdads.com's free coaching session'";
$recipientSubject="icoachdads.com's Contact Form";
$receiptMessage = "Thank you ".$firstName." for inquiring about icoachdads.com's free coaching session!\n\n\nHere is what you submitted to me:\n\n"
."--------CONTACT--------\n"
."Title: ".$Title."\n"
."First Name: ".$firstName."\n"
."Preferred Name: ".$lPreferedName."\n"
."Surname: ".$surname."\n"
."E-mail: ".$Email."\n"
."Street: ".$Street."\n\n--------ADDRESS--------\n"
."Apartment Number: ".$ApartmentNo."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$ZipCode."\n"
."Country: ".$country."\n"
."Daytime telephone: ".$daytimetel."\n\n--------PHONE--------\n"
."Can call in daytime: ".$cancallday."\n"
."Evening telephone: ".$eveningtel."\n"
."Can call in evening: ".$cancallevenin."\n"
."One thing: ".$OneThing."\n"
//----------------------------------
mail($email, $subject, $receiptMessage,"From:$toAddress");
//----------------------------------
mail($toAddress,$recipientSubject,$mailContent,"From:$email");
//--->echo $mailContent;
//////////////////////////////////////// CONNECT TO MYSQL DB ////////////////////
// OPEN CONNECTION --->
$connection=mysql_connect("localhost","#####", "#####") or die("Unable to connect!"); /* change this! */
mysql_select_db("#####") or die("Unable to select database!"); /* change this! */
// EXECUTE QUERY --->
$query="INSERT INTO GeneralContact (
Title,
firstname,
preferredname,
surname,
Email,
street,
ApartmentNo,
city,
state,
ZipCode,
country,
daytimetel,
cancallday'
eveningtel'
cancallevenin,
OneThing)
VALUES(
'".$Title."',
'".$firstName."',
'".$preferredname."',
'".$surname."',
'".$Email."',
'".$street."',
'".$ApartmentNo."',
'".$city."',
'".$state."',
'".$ZipCode."',
'".$country."',
'".$daytimetel."',
'".$cancallday."',
'".$eveningtel."',
'".$cancallevenin."',
'".$OneThing."',
//////----->
$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 - \n";
print "$error\n";
print "\n";
print "\n";
print "Please use your \"Back\" button to return to the form to correct the omissions. Thank you.\n";
}
?>
</body>
</html>

Reply With Quote
  #2  
Old January 31st, 2005, 08:15 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Thanks for highlighting your line =)

in the future, wrap your PHP code with [php] tags and the forum will make the code all fancy and colorized...

Anyways, in reference to your highlighed line... look at the line above the comment directly above it, where you're setting your $mailContent variable... you're missing a semicolon...

Code:
$mailContent="--------CONTACT--------\n"
."Title: ".$Title."\n"
."First Name: ".$firstName."\n"
."Preferred Name: ".$lPreferedName."\n"
."Surname: ".$surname."\n"
."E-mail: ".$Email."\n"
."Street: ".$street."\n\n--------ADDRESS--------\n"
."Apartment Number: ".$ApartmentNo."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$ZipCode."\n"
."Country: ".$couontry."\n"
."Daytime telephone: ".$dattimetel."\n\n--------PHONE--------\n"
."Can call in daytime: ".$cancallday."\n"
."Evening telephone: ".$eveningtel."\n"
."Can call in evening: ".$cancallevenin."\n"
."One thing: ".$OneThing."\n"
//----------------------------------
$toAddress="forms@icoachdads.com";

Reply With Quote
  #3  
Old January 31st, 2005, 09:42 AM
moggi1964 moggi1964 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 12 moggi1964 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 48 sec
Reputation Power: 0
Thanks

Just couldn't see it yet there it was (though I have spent almost every waking hour in front of the screen in the last three weeks).

I appreciate your help.

What do you mean about wrapping in pHP tags, can you give me an example so that next time I come back (and there is going to be a next time for sure) I can get it right?

Cheers.

Moggi

Reply With Quote
  #4  
Old January 31st, 2005, 12:15 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
It's always the small errors that get you... =)

PHP Code:
 $mailContent="--------CONTACT--------\n"
."Title: ".$Title."\n"
."First Name: ".$firstName."\n"
."Preferred Name: ".$lPreferedName."\n"
."Surname: ".$surname."\n"
."E-mail: ".$Email."\n"
."Street: ".$street."\n\n--------ADDRESS--------\n"
."Apartment Number: ".$ApartmentNo."\n"
."City: ".$city."\n"
."State: ".$state."\n"
."Zipcode: ".$ZipCode."\n"
."Country: ".$couontry."\n"
."Daytime telephone: ".$dattimetel."\n\n--------PHONE--------\n"
."Can call in daytime: ".$cancallday."\n"
."Evening telephone: ".$eveningtel."\n"
."Can call in evening: ".$cancallevenin."\n"
."One thing: ".$OneThing."\n"
//----------------------------------
$toAddress="forms@icoachdads.com"


^^ [php](pasted code)[/php] ^^

Reply With Quote
  #5  
Old January 31st, 2005, 04:28 PM
moggi1964 moggi1964 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 12 moggi1964 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 48 sec
Reputation Power: 0
Told you I would be back...

I have a new post in a new thread.

Last edited by moggi1964 : January 31st, 2005 at 08:20 PM. Reason: I have a new post in a new thread.

Reply With Quote
  #6  
Old February 1st, 2005, 08:06 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Something I just noticed... refer to my previous post, you spelt "$couontry" wrong... you might want to fix that, to avoid a future post

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Parse error confusing a newbie.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT