I have a short html form and some php code on the same page so that when the form is submitted, the entries appear on the same page. This code works as far as posting the entered information from the form to the page, but I have 2 problems:
The text box for some reason was only letting me enter 1 character, now it won't let me enter any characters.
Every time I refresh the page to try the form again, the information keeps appending. I only want/need for it to show up once after submission.
<form method="post" action=""> <label>Select Out of Office Message <select name = "selectoutofofficemessage"> <option value = "N/A">N/A</option> <option value = "Vacation">Vacation</option> <option value = "Conference">Conference</option> <option value = "Meeting">Meeting</option> <option value = "Other">Other</option> </select> <label>Custom Out of Office Message <input type="text" name="customoutofofficemessage" size="30" maxlength="255"/> </label> <p> <input type="submit" name="submit" value="Submit" /> </p> </form> <?php $selectoutofofficemessage = $_POST["selectoutofofficemessage"]; $customoutofofficemessage = $_POST["customoutofofficemessage"]; $posts = file_get_contents("posts.txt"); $posts = "$selectoutofofficemessage - $customoutofofficemessage\n" . $posts; file_put_contents("posts.txt", $posts); echo $posts; ?>