Appending string using php to a text file

This Tutorial Has Been Viewed 1,176 Times.

 

A very easy way to append string to a file using simple php script 

<?php

$fn = “file.txt”;

$file = fopen($fn, “a+”);

$space.= “\n”;

if($_POST['addition']) fwrite($file, $_POST['addition']);

fwrite ($file, $space);

fclose($file);

?>

<form action=”<?=$PHP_SELF?>” method=”post”>

<input type=”text” name=”addition”/><br/>

<input type=”submit”/>

</form>

 


VN:F [1.9.13_1145]
Rating: 5.5/10 (2 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

Appending string using php to a text file, 5.5 out of 10 based on 2 ratings



You will also be interested in ,

Tags: , ,

One Response

  1. Testing the form.

    VA:F [1.9.13_1145]
    Rating: 0.0/5 (0 votes cast)
    VA:F [1.9.13_1145]
    Rating: 0 (from 0 votes)

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP, scripts (123 of 150 articles)


 gethostbyname() is used to get the IP address corresponding to a given Internet host name.Examples code:<?php$ip = gethostbyname('www.mistonline.in');echo $ip;?>One way to discover your IP ...