I have a textarea
in my code, where the user will enter access vouchers separated by ENTER.
My PHP code treats the typed values as follows:
$voucher = explode("\n",$voucher);
foreach ($voucher as &$varray)
{
$gravar = mysqli_query("INSERT INTO 'vouchers' (voucher, tempo) VALUES ('$varray','$tempoBD')");
}
Where: $voucher
is the value of the textarea received via $_POST
and $tempoBD
is the value that the user selects converted in the format 00:00:00
.
The problem is: The voucher field is saving the value of the line + line break ( \n
)!
What correction in my code do I have to remove the line break in the voucher field with each record inserted in the table?
Thank you!