Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

424
Vistas
How to save form in two txt files html and php

I'm trying to submit a form with two text inputs and trying to save the two inputs to two separated text files but without success. I'm able to save the two inputs in one file but I can't manage to slipt the inputs in two separate text files.

Heres what i've tried:

HTML form:

<form action="run.php" method="post">
    Link:<br><input type="text" name="linkisv" value=""><br>
    Email:<br><input type="text" name="emailisv" value=""><br>
    <input type="submit" id ="submitButton" value="Submit">
</form>

The PHP solution:

<?php
$linkisv = $_POST["linkisv"]; //You have to get the form data
$emailisv = $_POST["emailisv"];
$file = fopen('configurationSettings.txt', 'w+'); //Open your .txt file
ftruncate($file, 0); //Clear the file to 0bit
$content = $linkisv. PHP_EOL .$emailisv;
fwrite($file , $content); //Now lets write it in there
fclose($file ); //Finally close our .txt
die(header("Location: ".$_SERVER["HTTP_REFERER"]));?>
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

With this code:

<?php
$linkisv = $_POST["linkisv"]; //You have to get the form data
$emailisv = $_POST["emailisv"];

// SAVING FIRST FILE
$file = fopen('configurationSettings.txt', 'w+'); //Open your .txt file
ftruncate($file, 0); //Clear the file to 0bit
$content = $linkisv;
fwrite($file , $content); //Now lets write it in there
fclose($file); //Finally close our .txt

// SAVING SECOND FILE
$file = fopen('second_file_name.txt', 'w+'); //Open your .txt file
ftruncate($file, 0); //Clear the file to 0bit
$content = $emailisv;
fwrite($file , $content); //Now lets write it in there
fclose($file); //Finally close our .txt

// REDIRECT
die(header("Location: ".$_SERVER["HTTP_REFERER"]));?>
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda