Jump to content

Month What?


absorr

Recommended Posts

Using HTML and PHP, it is supposed to post to the month.html but it doesn't. When I press submit it doesn't even show that it received the month. HTML <form action="events/submit.php" method="post"enctype="multipart/form-data">Month: <select name="month"> <option value="January">January</option> <option value="Febuary">Febuary</option> <option value="March">March</option> <option value="April">April</option> <option value="May">May</option> <option value="June">June</option> <option value="July">July</option> <option value="August">August</option> <option value="Septemper">September</option> <option value="October">October</option> <option value="November">November</option> <option value="December">December</option></select><br>Date:<INPUT TYPE="text" NAME="date" value="12"><br>Time:<INPUT TYPE="text" NAME="time" value="1:00-3:00pm"><br>Title:<INPUT TYPE="text" NAME="title"><br>Description:<br><TEXTAREA NAME="detail" ROWS="10" WRAP="hard"></TEXTAREA><br><input type="submit" name="submit" value="Submit" /></form> PHP <?php$a_str = array($_POST["month"],$_POST["date"],$_POST["time"],$_POST["title"],$_POST["detail"]);$contents = implode(PHP_EOL, $a_str);$contents .= PHP_EOL . PHP_EOL;file_put_contents("{$_POST['month']}.html", "<br><h2>{$_POST['month']} {$_POST['date']}, {$_POST['time']}</h2><b>{$_POST['title']}</b><br><p>{$_POST['detail']}</p><br>", FILE_APPEND);print("|$contents|");?> and no matter what month I selected, there is no html posted. What is wrong? It is most likely the HTML. Is it the select stuff?

Link to comment
Share on other sites

Hello there i am still a beginner in PHP so i am not sure if my points will be valid but i'll give it a try. First of all i am usually using an echo statement in my PHP file to see if i get all the data from the form, this way you can see if there is an error in the form or not. What is more (and i am really cautious about that since it's the first time i see the use of PHP_EOL) in your 3rd line in the php code you assign your $contents variable with the new line value, won't that replace what you had previously assigned to it? Again i am very new in this, i am just pointing out things that i would do, i may be completely wrong. Edit: Nevermind i missed the dot :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...