I want to create a small application with two functions. One will be called savedata that will retrieve from the GET container the data that we have written in the first and last fields of the form and will save it in our file. Another function will be called Verdatos and will show the names and last names saved in the .txt file of the saved data. with the savedata function. Does anyone know how to do it? So far I have tried this with this code, but I do not know how to define the true function
<html>
<?
if(isset($isset($_POST["ver"]))
{
echo "<h1> Datos almacenados </h1>";
ver();
}
else{
echo "datos guardados";
guardar();
}
function verdatos(){
$linea = fgets($texto);
echo $linea . '<br />';
}
}
function guardar(){
$nombre = $_POST["varnombre"];
$apellido = $_POST["varApellido"];
$texto = fopen( ' datos.txt' + "w");
fputs($texto,$nombre . "" . $apellido . PHP_EOL);
}
?>
</body>
</html>