How to register multiple sequence data from a textarea?
I'm doing php and came across the following problem: How to register multiple sequence data from a textarea?
My idea is to get the text from a textarea of a form via the POST method. And the text in question follow the following pattern:
Name 01, 01 Phone, Address 01
Name 02, 02 Phone, Address 02
Name 03, 03 Phone, Address 03
Each row contains information of a client and the commas will separate the data from the customer master record, I want each client to be registered with a different ID in the database (taking into account that later can be edited sepa开发者_开发百科rately).
I know as more or less as separate data line, but how to do this by separating comma?
I appreciate the help of those who have to help me in this matter and I apologize for my bad English.
One really primitive way is to do it by this:
$rows = explode("\n",$_POST['text']);
foreach($rows as $row)
{
$client = explode(",",$row);
$query = "INSERT INTO...". $client[0] ."..." . $client[1];
}
Of course, sanitize it.
精彩评论