I am coding a basic web page and one of the requirements is an html form that sends input via a php file.
I encoded the following in an html file:
<form method="post" action="formsubmit.php" name="Contact Form" id="contactform" enctype="multipart/form-data"> <fieldset> <legend align="center"> Your Details </legend> <p> <label for="fname">First Name: </label> <input type="text" id="fname" required/> <label for="sname">Surname: </label> <input type="text" id="sname" required/> <label for="email">Email Address: </label> <input type="email" id="email" required/> <label for="phone">Phone Number: </label> <input type="tel" id="phone" required/> <br /> <br /> </p> </fieldset> <fieldset> <legend align="center"> Third Parties </legend> <p> <label for="sharedetails">Tick this box if you would like to recieve ticket and event information from our carefully selected third parties.</label> <input type="checkbox" name="sharedetails" value="sharedetailsno" id="sharedetails" /> </p> <p> <input type="submit" value="Submit" /> <input type="reset" value="Clear" /> </p> </fieldset> </form>
and then created the following php file:
<html> <head> <title>Process Feedback</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <?php $fname = $_POST["firstname"]; $sname = $_POST["surname"]; $email = $_POST["email"]; $phone = $_POST["phone"]; $sharedetails = $_POST["sharedetails"]; print "test test $fname $sname $email $phone test test"; ?> </body> </html>
it is obvious that the php file is still in the testing phases, and I want it to return the provided data before formatting it correctly with the correct data output, etc.
but it always returns "Internal Server Error" when submitting the form. I searched the Internet for answers and found similar posts, but none of them helped my problem.
I am using Apache server on local system. Could the problem be incorrect?
If I can get the form data in order to correctly transfer the php file, I can format the remaining html page / output page.
source share