0

I need to take the form below and print on screen which works, but also write to a txt file with the PHP variables.

<html>
<body>

<form action="welcome.php" method="post">
Name: <input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>

</body>
</html> 

Welcome.php

<html>
<body>

Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>

</body>
</html> 
WTF_Mate
  • 19
  • 3
  • And what's the problem? – u_mulder Feb 26 '20 at 20:57
  • There is a minimum of effort required on your part. I chose 2 files to close this with, given the thousands of similar posts out there on the web. – Funk Forty Niner Feb 26 '20 at 21:01
  • The PHP code can write to the file as well as returning output to the browser. You don't need to make separate requests. – Don't Panic Feb 26 '20 at 21:01
  • When I use most examples including the ones provided. the HTML is left out. Solution 1 creates a file with the variables only and no HTML text aside from the "-" betwen the variables. My form displays Welcome Bob
    Your email is Bob@bob.com. The solutions only echo x bytes written. and the file only has the Bob - bob@bob.com its missing the Welcome and your email is.
    – WTF_Mate Feb 26 '20 at 22:10

0 Answers0