Page 1 of 1

Unexpected error, any help?

Posted: Mon May 29, 2006 5:54 pm
by akimm
Parse error: parse error, unexpected '\"' in /nfs/cust/8/25/05/650528/web/clairictionary/test.php on line 29

Code: Select all

<form action="test.php" method="POST"> 
<p><b>your name</b> 
<input type="text" name="name" size="30"></p> 

<p><b>your word</b> 
<input type="text" name="word" size="30"></p> 

<p><b>definition</b> 
<TEXTAREA NAME="definition" COLS="30" ROWS="5" 

WRAP="virtual"></TEXTAREA></P> 

<p><input type="submit" name="submit" value="send your word!"></p> 

<?php 
if ($_POST['name'] = "" && 
    $_POST['word'] = "" && 
    $_POST['definition'] ="") 
{ 
echo "Please fill out all boxes so I can see your great word";
} 
else {
$fp = fopen("words.txt", "a");

if(!$fp)  {
echo "WtF mate, it seems we've found an error";
exit;
}
## LINE 29->  fwrite($fp, $word ."=" .$definition  ."<br /> <br />" ."contributed by:             

$name"/n");

fclose($fp)
?>
}
?> 



<html> 
<head> 
</head> 
<body> 
<h1> the following email has been sent!</h1> 

<P><b>Your Name:</b><br> 
<?php echo $_POST['name']; ?>  
<P><b>Message:</b><br> 
<?php echo $_POST['word']; ?> 
<P><b>definition:</b><br> 
<?php echo $_POST['definition']; ?> 

</body> 
</html>

Posted: Mon May 29, 2006 6:11 pm
by TheMoose

Code: Select all

fwrite($fp, $word ."=" .$definition  ."<br /> <br />" ."contributed by: $name"/n");
Note the extra double quite in front of the /n. Not only that, but it should be \n if you want a newline.

Code: Select all

fwrite($fp, $word ."=" .$definition  ."<br /> <br />" ."contributed by: $name\n");

ah wonderful

Posted: Mon May 29, 2006 6:31 pm
by akimm
Thanks!