newbie needing help with a form
Posted: Wed Jan 08, 2003 10:47 pm
sorry for the newbie question, but i gotta start somewhere...
i am trying to write code where a person can edit a file via a form. the file does include html code in it. how can i get the textarea to write to the file without all the \" where i want just a "
here is my code
thanks in advance for your help. or if you can point me to a tutorial or something
i am trying to write code where a person can edit a file via a form. the file does include html code in it. how can i get the textarea to write to the file without all the \" where i want just a "
here is my code
Code: Select all
<? if ($Submitted == true){
$FileName = "scrollText.txt";
$FilePointer = fopen($FileName, "w+");
$Edit = $_POST['text'];
// the following line is my attempt at solving it, but i fail.
$Edit = eregi_replace(""",'"',$Edit);
fwrite($FilePointer, $_POST['text']);
fclose($FilePointer);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> ... blah blah blah
<form action="scrolledit.php" method="post">
<div class="content">Scroller Contents: (html allowed)<br></div>
<input type="hidden" name="Submitted" value="true">
<div class="content">
<textarea rows="5" cols="40" name="text">
// this part simply reads the contents of the file
// and places it in the textarea so it can be edited
<?PHP
$TheFile = "scrollText.txt";
$Open = fopen($TheFile, "a");
$Data = file($TheFile);
for ($n = 0; $n < count($Data); $n++){
$GetLine = explode("\t", $Data[$n]);
print ("$GetLine[0] $GetLine[1]");
}
fclose($Open);
?> </textarea></div>
<Input type="Submit" name="Submit" value="Submit!">
</form>
... blah blah blah </html>