Home php How to return to the main page of the site after opening...

How to return to the main page of the site after opening “send.php”?

Author

Date

Category

There is a file on php that sends data entered in forms on the site in a text file.

& lt; form action = "send.php" Method = Post & gt;
& lt; p & gt; Place an order & lt; p & gt;
& lt; div align = "center" & gt;
Name & lt; br / & gt;
& lt; input type = "text" name = "name" Size = "40" Required Placeholder = "Ivan" & gt; & lt; br / & gt;
Phone number & lt; br / & gt;
& lt; Input Type = "Text" name = "title" size = "40" Required Placeholder = "+ 380 949494201" & gt; & lt; br / & gt;
Order & lt; br / & gt;
& lt; Textarea Name = "MESS" ROWS = "10" COLS = "40" REQUIRED & GT; & LT; / Textarea & GT;
& lt; br / & gt;
& lt; Input Type = "submit" value = "Send" name = "Submit" Required & gt; & lt; / div & gt;
& lt; / form & gt;

After pressing the “Submit” button, the data from all three forms will be sent to the file, and how to return to the main page after switching to PHP file?
Here is the “send.php”

& lt;? php
$ F = Fopen ("textfile.txt", "a +");
FWRITE ($ F, $ _post ["Name"]. "\ r \ n");
FWRITE ($ F, $ _post ["Title"]. "\ r \ n");
FWRITE ($ F, $ _post ["MESS"]. "\ r \ n");
FWRITE ($ F, "-------------------". "\ r \ n");
FClose ($ F);
FClose ($ f);
FClose ($ f);
FClose ($ f);
? & gt;

Answer 1, Authority 100%

& lt;? php
 $ F = Fopen ("textfile.txt", "a +");
 FWRITE ($ F, $ _post ["Name"]. "\ r \ n." $ _ post ["title"]. "\ r \ n." $ _ post ["Mess"]. "\ r \ n") ;
 FWRITE ($ F, "-------------------". "\ r \ n");
 FClose ($ f);
 HEADER ("Location: index.php");
? & gt;

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions