Session error (maybe!!)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sisleysusie
Forum Newbie
Posts: 16
Joined: Wed Jan 14, 2004 9:44 pm

Session error (maybe!!)

Post by sisleysusie »

Hi all,
I got this error when i try to execute this code

error: Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting
T_STRING or T_VARIABLE or T_NUM_STRING in i:\usr\final_process.php on line 48


Can anyone here help me? I have been trying hard to figure it out what is wrong with my code. Could it be because of the session that i use? Actually there are three other pages before i come to this page. One is registration.php and then, it will go to first_process.php where i will register all the sessions of variables from registration.php, then confirmation.php which once filled it will bring me to final.php which contains the codes below. I really appreciate all your help. Thank you in advcance

Code: Select all

<?php


//Send email 
            $to =      $Bill_Email;
            $header =  "From: Friends Management Club\r \n";
            $subject = "Registration Confirmation";
            $message = "Thank you for signing up with Friends Management Club.\n
                        The summary of your registration is as the following\n\n
						Indivudual Info\n
						First name:$_SESSION['FirstName']\n
						Last name :$_SESSION['LastName']\n
						Salutations:$_SESSION['Salutations']\n
						Gender:$_SESSION['Gender']\n
						Citizenship:$_SESSION['Citizenship']\n
						Date of Birth:$_SESSION['DOB']\n
						Home Address:$_SESSION['Street'],$_SESSION['Building'],$_SESSION['City'],$_SESSION['Country'],$_SESSION['Zip']\n
						Educational Level:$_SESSION['Educational_Level']\n

												 ";
						
            mail( $to, $subject, $message, $header )
            or print "Mail not sent.";
		 }[/

?>
jaxn
Forum Commoner
Posts: 55
Joined: Fri Jan 16, 2004 1:50 pm
Location: Nashville, TN

Post by jaxn »

You can't call values within arrays like that within double quotes.

You have two options:

You can exit out of the quotes like this:

Code: Select all

<?php
$message = "Thank you for signing up with Friends Management Club.\n
                        The summary of your registration is as the following\n\n
                  Indivudual Info\n
                  First name:".$_SESSION['FirstName']."\n
                  Last name :".$_SESSION['LastName']."\n
                  Salutations:".$_SESSION['Salutations']."\n
                  Gender:".$_SESSION['Gender']."\n
                  Citizenship:".$_SESSION['Citizenship']."\n
                  Date of Birth:".$_SESSION['DOB']."\n
                  Home Address:".$_SESSION['Street'].",".$_SESSION['Building'].",".$_SESSION['City'].",".$_SESSION['Country'].",".$_SESSION['Zip']."\n
                  Educational Level:".$_SESSION['Educational_Level']."\n

                                     ";
?>
or, you can encapsulate array values withing curly braces like:

Code: Select all

<?php
$message = "Thank you for signing up with Friends Management Club.\n
                        The summary of your registration is as the following\n\n
                  Indivudual Info\n
                  First name:{$_SESSION['FirstName']}\n
                  Last name :{$_SESSION['LastName']}\n
                  Salutations:{$_SESSION['Salutations']}\n
                  Gender:{$_SESSION['Gender']}\n
                  Citizenship:{$_SESSION['Citizenship']}\n
                  Date of Birth:{$_SESSION['DOB']}\n
                  Home Address:{$_SESSION['Street']},{$_SESSION['Building']},{$_SESSION['City']},{$_SESSION['Country']},{$_SESSION['Zip']}\n
                  Educational Level:{$_SESSION['Educational_Level']}\n

                                     ";
?>
that method is my personal favorite.


-Jackson
sisleysusie
Forum Newbie
Posts: 16
Joined: Wed Jan 14, 2004 9:44 pm

Post by sisleysusie »

Thanks a lot Jaxn... now my problem has been solved.. Would love to add you in my friendster list. If you dont mind.. :)
Post Reply