Could someone please correct this PHP code i’ve looked it over several times and can’t find out what’s wrong with it?
[code=php]
<?php
if(empty($_GET[‘action’])){
?>
<form action=”<?php echo $_SERVER[‘PHP_SELF’]; ?>?action=write” method=”post”>
<textarea name=”contents” rows=”10″ cols=”60″>
<?php
$fp=fopen(“$_POST[‘file’]”, “r”);
while (!feof($fp)){
$line=fgets($fp);
print stripslashes(“$line”);
}
fclose($fp);
?>
</textarea><br/><br />
<input type=”submit” value=”Submit” />
</form>
<?php
}else{
$fp=fopen(“$_POST[‘file’]”, “w”);
fputs($fp, $_REQUEST[‘contents’]);
if (fclose($fp)){
print “<h2>File successfully saved</h2>n”;
}else{
print “<h2><font style=”color:red;”>There was a problem saving the file</font></h2>n”;
}
print “<input type=”button” value=”Go Back” onClick=”window.location.href='”.$_SERVER[‘PHP_SELF’].”‘;” />”;
}
?><br><br>Your File<hr><?php include “$_POST[‘file’]”; ?>
<html>
<head>
<title>Page Editer</title>
</head>
<body>
<form action=”<? $PHP_SELF ?>”>
<input type=”text” value=”file”>
<input type=”submit” value=”submit”>
</form>
</body>
</html>