Hi, I have a problem with my php and html form. What I am trying to do is just get a form with 7 input fields, 6 of these are input field or text area and one will be a checkbox. I have one hidden field, the first 3 boxes the hidden field the first name and message. The only problem I have is when I add a new input box it shows me the 500 error. My code is below:
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"]))
{
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<input type="hidden" name="subject" value="can you create me an account"><br>
Message: <textarea rows="10" cols="40" name="message"></textarea><br>
first <input type="text" name="first_name" >
<input type="submit" name="submit" value="Submit Feedback">
</form>
<?php
}
else
// the user has submitted the form
{
// Check if the "subject" input field is filled out
if (isset($_POST["subject"]))
{
$subject = $_POST["subject"];
$message = $_POST["message"];
$first = $_POST["first_name"];
$message = wordwrap($message, 70);
$first = wordwrap($first, 70);
// send mail
mail("summat@gmail.com",$subject,$message,$first,"subject: $subject\n");
echo "Thank you for sending us feedback";
When I add a new input box my code looks like :
<?php
// display form if user has not clicked submit
if (!isset($_POST["submit"]))
{
?>
<form method="post" action="<?php echo $_SERVER["PHP_SELF"];?>">
<input type="hidden" name="subject" value="can you create me an account"><br>
Message: <textarea rows="10" cols="40" name="message"></textarea><br>
first <input type="text" name="first_name" >
last <input type="text" name="last_name" >
<input type="submit" name="submit" value="Submit Feedback">
</form>
<?php
}
else
// the user has submitted the form
{
// Check if the "subject" input field is filled out
if (isset($_POST["subject"]))
{
$subject = $_POST["subject"];
$message = $_POST["message"];
$first = $_POST["first_name"];
$last = $_POST["last_name"];
$message = wordwrap($message, 70);
$first = wordwrap($first, 70);
$last = wordwrap($last, 70);
// send mail
mail("summat@gmail.com",$subject,$message,$first,$last,"subject: $subject\n");
echo "Thank you for sending us feedback";
Everything shows on the screen when I add them but when I press submit I get:
500 - Internal server error. There is a problem with the resource you are looking for, and it cannot be displayed.
and nothing gets submitted. Is it because it times out before it send or to much data or have I just missed something very basic?
Any help would be much appreciated.