Hello, I was wondering if it is possible to create a text file with text in it from html, and if so, is it possible to specify a name for that text file as well?
I've tried using this code but it doesn't work and i dont know the proper way to create a htaccess file because i've never used php before, so i need help with doing that.
<html>
<head>
<title>Writing to a text file</title>
</head>
<body>
<?php
// Open the text file
$f = fopen("textfile.txt", "w");
// Write text line
fwrite($f, "PHP is fun!");
// Close the text file
fclose($f);
// Open file for reading, and read the line
$f = fopen("textfile.txt", "r");
echo fgets($f);
fclose($f);
?>
</body>
</html>
Lastly can someone explain what this code is doing specifically? Thank you.