I am making a simple post script: <?php //Get user input $nickname=$_POST("nickname"); $message=$_POST("message"); //include chatlist include("chatlist.php"); //switch all the variables down the list include("variablechange.php"); //rewrite chatlist $File = "chatlist.php"; $Handle = fopen($File, 'w'); $Data = "<?php $display=" $whole " ?>"; fwrite($Handle, $Data); fclose($Handle); //redirect echo "Your message has been posted. Please wait..."; include("redirect.php"); ?> I have an error: Parse error: syntax error, unexpected T_VARIABLE in C:\Program Files\Abyss Web Server\htdocs\forum\chat.php on line 16 I am not very good with php. Could somebody help me???
Change this line $Data = "<?php $display=" $whole " ?>"; PHP: To $Data = "<?php $display=" . $whole . " ?>"; PHP: You can't concatenate strings like that in PHP - they have to have a period.
You should definitely secure this: $nickname=$_POST("nickname"); $message=$_POST("message"); filter the $_POST variables if you are using $nickname or $message with a database, or you'll get hacked easily.