Jump to content

Help, please!


rpope904

Recommended Posts

I am trying to write a php script, that writes a php file.. all is going good until line 180.. Here's the error:

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/rpope904/public_html/x10chat/signup_2.php on line 180

 

Here's the code:

 

LINE 176> $stringData = "<param name=\"CABINETS\" value=\"irc.cab,securedirc.cab,pixx.cab\">\n";

LINE 177> fwrite ($fh, $stringData);

LINE 178> $stringData = "<?\n";

LINE 179> fwrite ($fh, $stringData);

LINE 180> $stringData = "$ni = $_POST[\'nickname\']; \n";

LINE 181> fwrite ($fh, $stringData);

LINE 182> $stringData = "echo \"<param name=nick value=\".$ni.\"_xC\">\n";

LINE 183> fwrite ($fh, $stringData);

LINE 184> $stringData = "?>\n";

 

Basically, what I need it to write to the file is:

<?

$ni = $_POST['nickname'];  LINE 180

echo "<param name=nick value=".$ni."_xC>\n"; LINE 182

?>

Link to comment
https://forums.phpfreaks.com/topic/91161-help-please/
Share on other sites

this would fix your problem

$stringData = "$ni = {$_POST['nickname']}; \n";

 

but if you're generating a php file, wouldn't you want to literally write that string to the file, as in

$stringData = '$ni = $_POST["nickname"];'."\n";

 

Otherwise your generated php file will contain the value of $ni rather than literally $ni.

 

Try echoing out both the statements I've shown to see the difference.

Link to comment
https://forums.phpfreaks.com/topic/91161-help-please/#findComment-467207
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.