Quote:
Originally Posted by Chris
i already have one code but it doesnt work on my server
Code:
<HTML>
<HEAD><TITLE></TITLE></HEAD>
<BODY>
<?
if ($_POST['data'] != "") {
$filedata=@explode(",",@file_get_contents("file.txt"));
if ($filedata != "") {
if (array_search($_POST['data'],$filedata) == FALSE) {
$filedata[]=$_POST['data'];
file_put_contents("file.txt",implode(","$filedata));
echo "<h2>data added to file</h2><br /><br />";
} else {
echo "<h2>data already exists in file</h2><br /><br />";
}
} else {
$filedata=array();
$filedata[]=$_POST['data'];
file_put_contents("file.txt",implode(","$filedata));
echo "<h2>data added to file</h2><br /><br />";
}
}
?>
<FORM method="post" action="<? echo($_SERVER['PHP_SELF']); ?>">
<input type="text" size="30" maxlength="255" name="data">
</FORM>
</BODY>
</HTML>
spits out Parse error: syntax error, unexpected T_VARIABLE in /usr/www/virtual/jupzchris/www.jupzchris.com/email.php on line 10
|
Change line 10, that reads:
file_put_contents("file.txt",implode(","$filedata) );
change it to:
file_put_contents("file.txt",implode(",",$filedata ));
You're welcome.
