I have a PHP form and I want to save the selected values to a file one in a line. I am not very much used with PHP.
Right now, my script is storing data in one line with many other characters included. Below is the code I am using in the action.php
if(isset($_POST))
{
$o = json_encode($_POST);
file_put_contents('data.txt',$o);
die();
}
The output I am receiving in data.txt is like below.
{"formDoor":["phpandmysql.tk\r\n","mytestdomainjordi\r\n","my1domain\r\n","ihatelinux\r\n","php1andmysql.tk\r\n","lubitz.co\r\n","testereed.com\r\n"],"formSubmit":"Submit"}
What I would like to get is something like this::
phpandmysql.tk
mytestdomainjordi
my1domain
ihatelinux
php1andmysql.tk
lubitz.co
testereed.com
I googled to come this far, can somebody help me?
Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire