Posts

Showing posts from January, 2025

Adding a new row in a textfile using PHP

Image
   How to append a new row in a text file using PHP        Manipulating text files is a common task when we are storing data in text files.   This tutorial shows how to add or append a new line to an existing text file.  There is a text file name: states.txt. In this file, each row is delimited with a semicolon. There is another form.html file, take data from users and submits to PHP file. PHP file receives submitted data and writes at the bottom of the states.txt file.    States.txt file looks as follows: form.html <html> <head> <title> Codingzon Tutorials </title> </head> <body> <h3> Please fill following details </h3> <form action= "demo.php" method= "POST" > State Name: <input type= "text" name= "statename" /><br /> <br /> Capital City : <input type= "text" name= "capitalcity" /><br />   ...