I am working on a form that will allow a user to submit text to the website and save it as a file on the server that I can retrieve later. I am using the following form:
<p>
<label for="Name">First Name</label>
<input type="text" name="Name" id="Name" />
</p>
<p>
<label for="Last Name">Last Name</label>
<input type="text" name="LastName" id="LastName" />
</p>
<p>
<label for="GuideName">Guide Name</label>
<input type="text" name="GuideName" id="GuideName" />
</p>
<p>Copy and paste your study guide into this box.</p>
<p>
<textarea name="Guide" id="Guide" cols="100" rows="30"></textarea>
</p>
<p>Submit
<input type="submit" name="Submit" id="Submit" value="Submit" />
</p>
</form>
and the following PHP code:
<?php
if (isset($_POST['Submit']))
{
$firstName = $_POST['Name'];
$lastName = $_POST['LastName'];
$guideName = $_POST['GuideName'];
$guide = $_POST['Guide'];
$finalGuideName = $guideName."(".$firstName." ".$lastName.").txt";
$fh = fopen($finalGuideName, 'w') or die("can't open file");
fwrite($fh, $guide);
fclose($fh);
}
?>
I've used this code (at least I think it's this code) in the past to take the user's information and create a text file on the server with it. However, when I got to check to see if the form worked, nothing appears on the server. What am I doing wrong? Thanks in advance.
Thanks for your help everyone, as I was trying to fix it, it started to work again. I have absolutely no idea why, I'm pretty sure I didn't change anything, but thanks again for all your help.