For Writing a Text file we make three files in one folder.
- index.php [ which contain some HTML input container and a submit button]
- filewrite.php [ it is a server script page]
- file.txt [create a blank text file]
index.php
------------------------------
<form action="filewrite.php" method="POST">
Name:<input type="text" name="name"><br>
Pass:<input type="text" name="pass"><br>
Type:<input type="text" name="type"><br>
<input type="submit" value="Submit"><br>
</form>
Name:<input type="text" name="name"><br>
Pass:<input type="text" name="pass"><br>
Type:<input type="text" name="type"><br>
<input type="submit" value="Submit"><br>
</form>
----------------------------------
filewrite.php
----------------------------------
<?php
$file = fopen("file.txt","a");// "a" means append
fwrite($file,"name:".$_POST["name"]."\r\n"."type:".$_POST["type"]."\r\n"."pass:".$_POST["pass"]."\r\n");
fclose($file);
?>
---------------------------------
Run the index.php file then see what happen ..
it's too simple to write a text file.
Run the index.php file then see what happen ..
it's too simple to write a text file.
Go and open your " file.txt " .....
Keep Smile :)
Keep Smile :)