Jump to content

[SOLVED] Inserting line breaks into a txt file


nvidia

Recommended Posts

Hi, i have a form where people selects values via radio buttons. When they press submit it should be stored in a text file. How do i insert a line break so that every time they press submit, each value will be on a separate line?
form1.html
Mr.X <input type="radio" name="select" value="Mr.X " CHECKED> <br />
Tom Cruis <input type="radio" name="select" value="Tom Cruis " ><br />

handler1.php file
 
session_start();
$selection = $_POST['select'];
// store location of file in variable
$filename= "/home/eland/u1/kbccs/w1009048/public_html/Internet_Pg/C2/C2.txt";

$fp = fopen($filename,'r+); 
$write = fwrite($fp, "$selection\r\n");

At the moment when they select a second value, it goes onto another line, but i only see it partially in the C2.txt file.For example
Mr.X
is
Please help anybody :(



Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.