-3

I am currently using fwrite, and this is what outputs as an error:

Parse error: syntax error, unexpected ')' in /home/blah/blahblah.com/write/submit.php on line 5

The code goes like this:

$strlen  = strlen ( $_REQUEST["content"] );
$content = $_REQUEST["content"];
$title   = $_REQUEST["title"];
$fp      = fopen( "/home/blah/blahblah.com/write/texts/" . $_POST["title"] . ".txt" , a+ );
fwrite ( $fp , $content , $strlen );
fclose ( $fp );

Please help! I even tried to put in strlen of the text (which is unnecessary) so that it wouldn't expect anything else!

jeffw
  • 1
  • 3
  • @vascowhite yeah, but I noticed most people came here with a bunch of code at hand and asking why this and that is like this and that, basically they are in a stage of debugging. – Dexter Huinda Jun 20 '12 at 18:25
  • @vascowhite This is where everyone else debugs, why shouldn't I? – jeffw Jun 22 '12 at 02:16

1 Answers1

2

The mode needs to be quoted:

$fp = fopen( "/home/blah/blahblah.com/write/texts/" . $_POST["title"] . ".txt" , "a+" );

It's currently being interpreted as an addition, I suspect.

andrewsi
  • 10,807
  • 132
  • 35
  • 51