Hello,
I have 1 file notex.php with both form and php scripting .
FORM IS THIS :
----------------------
<form action="notesx.php" method="post">
<fieldset>
<legend>
Capítulo 01:
</legend>
<textarea id='userInput' name="textspace" value="'.$textspace.'" cols="40" rows="3" ></textarea>
<br>
<input type="submit" name="save" value='save'/>
<input type="submit" name="edit" value='edit'/>
<input type="submit" name="show" value='show'/>
<br>
<p><b id='boldStuff2'></b> </p>
</fieldset>
</form>
and
PHP code is this :
---------------------------------
<?php
if ($_POST['save'])
{
$space = $_POST['textspace'];
$myFile = "testFile.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $space);
fclose($fh);
echo "Saved";
}
if ($_POST['edit'])
{
$textspace="rajan";
}
if ($_POST['show'])
{
$myFile = "testFile.txt";
$fh = fopen($myFile, 'r');
if(filesize($myFile)!=0)
{
$theData = fread($fh, filesize($myFile));
}
else
{
echo "The file is empty";
}
fclose($fh);
echo $theData;
}
?>
Now,this is what I want.Well,write and read is working great,but i want that when edit button is pressed the TEXTAREA is updated/filled with the file's content/data .for testing purposes I just assigned rajan to $textspace,hence if it works correct,on pressing edit button the TEXTAREA must be updated with rajan.Please help !!! I am not sure of using this syntax value="'.$textspace. in the TEXTAREA .. pLEASE GUIDE ME !! tHANKS IN ADVANCE ..