I currently have a simple form with a textarea, just for testing. For example:
<form method="post" action="submit.php">
<textarea name="textarea">
</textarea>
<input type="submit" value="Enviar">
</form>
My wish is that the user copy and paste information in the textarea assuming that I will register it later in a table with the following fields:
mail | name | surname | address | phone
The user must respect this structure regardless of the number of records they wish to upload (I will guide it with a placeholder).
The issue is that if I send the information in this way:
Printing it in a var_dump like this:
<?php
$textarea = $_POST['textarea'];
$rows = preg_split("/[\n]/", $textarea);
var_dump($rows);
The data would be organized in this way:
Perfectly going through the array if it were a data by row I could register it in a database, but as each row are different fields to register in that case I don't see how I can treat the data and be able to make each row a record, assuming that the rows will be "n" quantity but always with the 5 fields previously described.
Any help to make these records would be appreciated
I leave you the original code here (in case you have problems with the delimiter): Example in google Drive
As you can see, the delimiter text (gray color) generated by excel, is not a blank space, it is a tap (you can see that it is bigger than a normal blank space
The result is as follows