Explain in detail please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Explain in detail please

<?php if(isset($_POST['text'])) { $name = $_POST['text']; $handle = fopen('names.txt', 'a'); fwrite($handle, $name."\n"); fclose($handle); } ?> <form method="post"> Name: <input type="text" name="text" /> <input type="submit" name="submit" /> </form>

22nd Jun 2019, 6:35 AM
afsha tamboli
afsha tamboli - avatar
1 Answer
+ 3
The text you submit in the form will be stored in $name variable after submitting the form, later names.txt will be opened with append mode, with fwrite you write down the content in $name with new line. Then close the file.
22nd Jun 2019, 7:16 AM
Yathin Babu
Yathin Babu - avatar