Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

423
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda