I need to create a html form hosted on my web site. When the form is submitted it posts to a script (script A) hosted on another site. Script A takes the data posted from the form and does some processing, sorting and organizing of the information from the my form.
Then script A passes the "re-organized" data back to my form page in the following format as plain text:
STREET= my street
STREET= still my street
I'd like to be able to take the response above and assign the value from each line to a variable. For example:
you can use the explode function which searches a string for a character (or characters) and splits it into an array which you could then referance by the arrays element. I usually avoid exploding strings by special characters like a newline because different environments can treat them differently. The most common use is a comma but I tend to use 3 &'s like this...
// read a file called text which has items seperated by &&&
$filelocation = 'text.txt';
$newfile = fopen($filelocation,"r");
$content = fread($newfile, filesize($filelocation));
// show a <p> inbetween all items
$items = explode("&&&",$content);
for ($i=0; $i<count($items); $i++) echo "$items[$i]<p>";