Forms in websites that give you responses in three steps
catchacoled (21)

For all my unexperienced programmers out there trying to make themselves a site you prob know that if you just put a form there it will not give you the answers when someone uses it. To make it give you the answer follow this tutorial.



Type this above all code on the entire page. This goes outside of the <html> at the top of the file

//This will make you able to create session variables

Step 2:


To make your form appear on your site use this code

<form action="form.php" method="post>
<!-Your form text space->
<input type="text" name="text">
<!-Your submit button->
<input type="submit" name="submitBtn">

That will make the form appear on your site. That one is just a text bar and submit button.

Step 3:


For the PHP part. This part will make it where when a person submits the form it will create a new file named response.txt and will show you what they said.
type this only in the PHP file

//creates session variable out of text
$_SESSION['response'] = $_POST['text'];
//opens response.txt
$file = fopen("response.txt", "w");
//Writes what they said
fwrite($file, $_SESSION['response'];
//Ends the writing process

Now when you wanna check if anyone has responded to your form go to response.txt and it will have everything that has been said in the form.

You are viewing a single comment. View All