Problems with a Join Form


#1

Ok, well I run a group type thing on the internet, and I have used a code someone provided for me, and edited it to fit my needs. Now I recieve and error every time I attempt to submit the form:

"Warning: Unexpected character in input: ‘’ (ASCII=92) state=1 in /home/u2/bardicwolf/html/Averna/join.php on line 38

Parse error: parse error in /home/u2/bardicwolf/html/Averna/join.php on line 38"

I don’t understand what it’s talking about, but here’s the php I used:

[php]

<? $email = $HTTP_POST_VARS['e-mail']; $name = $HTTP_POST_VARS['name']; $age = $HTTP_POST_VARS['age']; $race = $HTTP_POST_VARS['race']; $other = $HTTP_POST_VARS['other']; $job = $HTTP_POST_VARS['job']; $wealth = $HTTP_POST_VARS['wealth']; $class = $HTTP_POST_VARS['class']; $desc = $HTTP_POST_VARS['description']; $spells = $HTTP_POST_VARS['spells']; $magicalitems = $HTTP_POST_VARS['mgcitems']; $rareitems = $HTTP_POST_VARS['rareitems']; if(($email == "") || ($name == "") || ($age == "") || ($race == "") || ($other == "") || ($job == "") || ($wealth == "") || ($class == "") || ($desc == "") || ($spells == "") || ($magicalitems == "") || ($rareitems =="")){ echo <<<END Averna Castle
Sorry, but your form can not be accepted, as you left one or more spaces blank. Please try again.
END; }else{ $mailBody = "Name: " . $name . "nE-mail: " . $email . "nRace: " . $race . "Other Race: " .$other . "nProfession: " . $job . "nAge: " . $age . "nWealth: .$wealth . "nClass .$class . "nSpells: " . $spells . "nRare Items: " . $rareitems . "nImage: " . $img . "nMagical Item(s): " . $magicalitems . "nDescription: " . $desc; mail("Averna@bardicwolf.com", "Membership Application -- " . $name, stripslashes($mailBody), "From: {$email}rn" . "Reply-To: {$email}"); echo <<<END Averna
Thank you $name! Your join application has been sent. The following is what you had entered:
E-mail Address: $email
Character Name: $name
Age: $age
Race: $race
Profession: $job
Wealth: $wealth
Class: $class
Description: $desc
Spells: $spells
Magical Items: $magicalitems
Rare Items: $rareitems
END; } ?>

[/php]
Mod Edit: Added PHP BBCode Tags
And here’s a link to the page I’m trying to use it in: http://www.bardicwolf.com/Averna/join.htm

Can anyone help me?


#2

If you look into your code at this line:


$mailBody = "Name: " . $name . "nE-mail: " . $email . "nRace: " . $race . "Other Race: " .$other . "nProfession: " . $job . "nAge: " . $age . "nWealth: .$wealth . "nClass .$class . "nSpells: " . $spells . "nRare Items: " . $rareitems . "nImage: " . $img . "nMagical Item(s): " . $magicalitems . "nDescription: " . $desc;  

Notice you have “Other Race” You should have n in place of that and that should help.


#3

Oh! Thanks!

[Edit]Fixing that didn’t seem to work. Any other reason it might be doing this?


#4

You need to read the message:
"Warning: Unexpected character in input: ‘’ (ASCII=92) state=1 in /home/u2/bardicwolf/html/Averna/join.php on line 38

First of all note the line is 38 (although it is not always exactly the line it should be, depending on the error, but this particular one looks to be accurate).

Since I did not count all the lines (nor will I) I suspect line 38 is your $mailBody assignment statement.

Now the error message is pretty basic. UNEXPECTED CHARACHTER and it tells you the Character which is the backslash . Since that line seems to have SEVERAL 's you need to check that they are properly used. You are escaping (newline) a charater, but it must be in quotes. Since the concatenation is so long it’s very easy to miss a quote mark (which you did). I also noticed that you missed a backslash and an n .

Please see below to further illustrate:

MODIFIED (HIGHLIGHTED)
$mailBody = "Name: " . $name . "nE-mail: " . $email . "nRace: " . $race . "nOther Race: " .$other . "nProfession: " . $job . "nAge: " . $age . "nWealth:" .$wealth . "nClass" .$class . "nSpells: " . $spells . "nRare Items: " . $rareitems . "nImage: " . $img . "nMagical Item(s): " . $magicalitems . "nDescription: " . $desc;

MODIFIEDCORRECTED (IN PHP CODE TAGS)
[php]$mailBody = "Name: " . $name . "nE-mail: " . $email . "nRace: " . $race . "nOther Race: " .$other . "nProfession: " . $job . "nAge: " . $age . "nWealth: ".$wealth . "nClass ".$class . "nSpells: " . $spells . "nRare Items: " . $rareitems . "nImage: " . $img . "nMagical Item(s): " . $magicalitems . "nDescription: " . $desc; [/php]

ORIGINAL (IN PHP CODE TAGS)
[php]$mailBody = "Name: " . $name . "nE-mail: " . $email . "nRace: " . $race . "Other Race: " .$other . "nProfession: " . $job . "nAge: " . $age . "nWealth: .$wealth . "nClass .$class . "nSpells: " . $spells . "nRare Items: " . $rareitems . "nImage: " . $img . "nMagical Item(s): " . $magicalitems . "nDescription: " . $desc; [/php]


#5

Oh thanks! It works now!