Hello,
I am trying to write this little file in my server, but always happens
Warning: fopen("data", "a+") - Permission denied in...
I know that I can do it when the php code is inside of html code and the file is craeted for the user apache, but I have the html and php code separete.
any idea?
<?php
//load the page and fill the select with the data pass on result
function load_page(){
$load = file('savedataV1.0.html');
$page = implode('',$load);
echo $page;
}
function save_file_from_textarea(){
$text=$_POST['data'];
$filepointer = fopen('data','a+');
//save the submitted form data to the file
fwrite($filepointer,$text);
fclose($filepointer);
}
load_page();
if(isset($_POST['save_data'])){
save_file_from_textarea();
unset($_POST['save_data']);
}
?>
you don't need it but just in case
html code
<HTML>
<HEAD>
<TITLE></TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-2">
</HEAD>
<BODY>
<FORM NAME="form1" ACTION="savedataV1.0.html" METHOD="post" >
Data <BR><TEXTAREA cols=90 name="data" rows=5></TEXTAREA>
<BR> <INPUT NAME="save_data" TYPE="submit" VALUE="save">
</BODY>
</HTML>