Hello! First post here. I made an "interview" webpage. Basically just the typical Question then Textbox thing. I think it'll be more clear if I posted the code.
<html>
<title> PHP </title>
<head>
</head>
<body>
<form name="form1" method="POST" action="TestProcess.php">
What is your name on Facebook?<br>
<input type="text" size=100 name="Question1"><br>
<br>
Why do you deserve to be an admin?<br>
<input type="text" size=100 name="Question2"><br>
<br>
Do you have any past experiences of being an administrator? Yes or No?<br>
<input type="text" size=100 name="Question3"><br>
<br>
What are your skills?<br>
<input type="text" size=100 name="Question4"><br>
<br>
What about your managing skills, how is it? Rate it 1-10<br>
<input type="text" size=100 name="Question5"><br>
<br>
Why should we choose YOU over the other applicants?<br>
<input type="text" size=100 name="Question6"><br>
<br>
Are you active? How much?<br>
<input type="text" size=100 name="Question7"><br>
<br>
<br>
<br>
<br>
<input type="Submit" name="Submit1" value="Submit">
</form>
</body>
</html>
Now that should be easy, it's just those "<br>" tags that expand it lol. Here's the TestProcess.php
<?php
$q1=$_POST['Question1'];
$q2=$_POST['Question2'];
$q3=$_POST['Question3'];
$q4=$_POST['Question4'];
$q5=$_POST['Question5'];
$q6=$_POST['Question6'];
$q7=$_POST['Question7'];
$fn="TestPHPAnswers.txt";
$file=fopen($fn, "a+");
fwrite($file, $q1."/n".$q2."/n".$q3."/n".$q4."/n".$q5."/n".$q6."/n");
fclose($file);
print("Application Sent");
?>
By looking at the code, you'll realize I have 3 pages for my site. The concept I have in mind is:
1. Users fill out textboxes. These textboxes have specific names.
2. The values of the textboxes are assigned to variables.
3. The TestProcess opens a text file in the site (more on this later, I'm a bit confused.) and appends the variables to it, then close. That's it. Now, when I tried to run my code, went through everything. I was surprised that the text file is untouched. No modifications or anything. Does it have something to do with the "$fn" part? Should I do "www.example.com/TestPHPAnswers.txt" or just "TestPHPAnswers.txt"?
I also tried the "file_put_content" thing, still didn't work. Can someone tell me what's wrong? and maybe, nudge me into the right solution? Thanks (Anyways, I just started PHP two days ago. Pretty sure I'm missing out on something.)