By php I generate and save a txt file that contains the data captured from a textfield, but when reading it from an application that I am creating it turns out that it has a blank space of more. How can I save my txt with the info lines I want without generating a blank space at the end?
PHP code to save data in TXT:
if ($_POST["txtopc1"])
{
$miopc1=$_POST["txtopc1"];
if ($miopc1!="")
{
$archivo='D:\letritastv\aplicacion\nivel_1\opcion1.txt';
$file = fopen($archivo, 'a') or die ();
fwrite($file,$miopc1.PHP_EOL);
fclose($file);
echo "He recibido en el archivo.php: ".$_POST["txtopc1"];
}
else { $miopc1=""; }
}
else{echo "He recibido un campo vacio";}
Code to read my file in LUA:
local opc1 = io.open("nivel_1/opcion1.txt","r")
local mopc1= opc1:read("*all")
objdib = objetos:new()
objdib:dibujar(mopc1)
function objetos:dibujar (mopc1)
canvas:attrColor('red')
canvas:attrFont('Tiresias','40','normal')
canvas:drawText(70,100,mopc1)
canvas:flush()
end
The result of reading my txt file is a box that represents a blank space: