Highlighted

Simple .php mail form won't work?

New Here ,
Jan 06, 2018

Copy link to clipboard

Copied

Hi all... I am graphic designer that is new to web design and am trying to create and email contact form on my website, however when i ftp upload and try to use the form it comes up with the following error - I have gone through a number of tutorials on the internet and nothing seems to fix this problem - can anyone help?-

is currently unable to handle this request.

HTTP ERROR 500

...here is the code...

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>contactform</title>

</head>

<body>

<?php

if (isset($_POST['submit'])){

$name=$_POST['name'];

$email=$_POST['email'];

$phone=$_POST['phone'];

$comment=$_POST['comment'];

$to='myemail@bigpond.com';

$subject='New Message';

$message="Name: ".$name."\n"."Phone: ".$phone."\n". "Wrote the following: "."\n\n".$comment;

$headers="From: ".$email;

if (mail($to, $subject, $comment, $headers)){

echo "Your Message has been sent"." ".$name.", We will contact you shortly!";

}

else{

echo "Something went wrong!";

}

}

?>

</body>

</html>

html code...

<div id="formwrapper">

                              <form action="contactform.php" method="post" name="form1" id="form1">

                              <p>

                                <span class="bodytextGrey">Full Name

                                </span>

                                <input name="name" type="text" required class="formstyle" id="name" form="form1" size="30">

                              </p>

                              <p>

                                <label for="email" class="bodytextGrey">Email*</label>

                                <input name="email" type="email" required class="formstyle" id="email" form="form1" size="34">

                              </p>

                              <p>

                                <label for="phone" class="bodytextGrey">Contact No.                              </label>

                                <input name="phone" type="tel" required class="formstyle" id="phone" form="form1" size="29">

                            </p>

                              <p>

                                <label for="comment"><span class="bodytextGrey">Comments</span><br>

                              </label>

                                <textarea name="comment" cols="53" rows="10" id="comment" form="form1"></textarea>

                                <label for="textfield2">                                  <br>

                                </label>

                              </p>

                              <table width="100%" border="0" cellspacing="0" cellpadding="0">

                                <tbody>

                                  <tr>

                                    <td align="center"><input name="submit" type="submit" class="submitbutton" id="submit" form="form1" formaction="form_process.php" formmethod="POST" value="Submit"></td>

                                  </tr>

                                </tbody>

                              </table>

                              <p> </p>

                          </form>

                           </div>

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

I think that your submit button contains erroneous code like the formaction which is different to action in the form element. I also think that security is going to be an issue if you persue with your code.

Have a look at what Nancy suggests at Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1). Please ignore the Bootstrap stuff if you are not using it. Just read the article and take note of the PHP code.

Views

320

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Simple .php mail form won't work?

New Here ,
Jan 06, 2018

Copy link to clipboard

Copied

Hi all... I am graphic designer that is new to web design and am trying to create and email contact form on my website, however when i ftp upload and try to use the form it comes up with the following error - I have gone through a number of tutorials on the internet and nothing seems to fix this problem - can anyone help?-

is currently unable to handle this request.

HTTP ERROR 500

...here is the code...

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>contactform</title>

</head>

<body>

<?php

if (isset($_POST['submit'])){

$name=$_POST['name'];

$email=$_POST['email'];

$phone=$_POST['phone'];

$comment=$_POST['comment'];

$to='myemail@bigpond.com';

$subject='New Message';

$message="Name: ".$name."\n"."Phone: ".$phone."\n". "Wrote the following: "."\n\n".$comment;

$headers="From: ".$email;

if (mail($to, $subject, $comment, $headers)){

echo "Your Message has been sent"." ".$name.", We will contact you shortly!";

}

else{

echo "Something went wrong!";

}

}

?>

</body>

</html>

html code...

<div id="formwrapper">

                              <form action="contactform.php" method="post" name="form1" id="form1">

                              <p>

                                <span class="bodytextGrey">Full Name

                                </span>

                                <input name="name" type="text" required class="formstyle" id="name" form="form1" size="30">

                              </p>

                              <p>

                                <label for="email" class="bodytextGrey">Email*</label>

                                <input name="email" type="email" required class="formstyle" id="email" form="form1" size="34">

                              </p>

                              <p>

                                <label for="phone" class="bodytextGrey">Contact No.                              </label>

                                <input name="phone" type="tel" required class="formstyle" id="phone" form="form1" size="29">

                            </p>

                              <p>

                                <label for="comment"><span class="bodytextGrey">Comments</span><br>

                              </label>

                                <textarea name="comment" cols="53" rows="10" id="comment" form="form1"></textarea>

                                <label for="textfield2">                                  <br>

                                </label>

                              </p>

                              <table width="100%" border="0" cellspacing="0" cellpadding="0">

                                <tbody>

                                  <tr>

                                    <td align="center"><input name="submit" type="submit" class="submitbutton" id="submit" form="form1" formaction="form_process.php" formmethod="POST" value="Submit"></td>

                                  </tr>

                                </tbody>

                              </table>

                              <p> </p>

                          </form>

                           </div>

Adobe Community Professional
Correct answer by BenPleysier | Adobe Community Professional

I think that your submit button contains erroneous code like the formaction which is different to action in the form element. I also think that security is going to be an issue if you persue with your code.

Have a look at what Nancy suggests at Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1). Please ignore the Bootstrap stuff if you are not using it. Just read the article and take note of the PHP code.

Views

321

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 06, 2018 0
Adobe Community Professional ,
Jan 06, 2018

Copy link to clipboard

Copied

I think that your submit button contains erroneous code like the formaction which is different to action in the form element. I also think that security is going to be an issue if you persue with your code.

Have a look at what Nancy suggests at Alt-Web Design & Publishing: Responsive Contact Form with Bootstrap 3.2 and PHP (Part 1). Please ignore the Bootstrap stuff if you are not using it. Just read the article and take note of the PHP code.


Ben

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 06, 2018 0
New Here ,
Jan 06, 2018

Copy link to clipboard

Copied

Thank you, Ben...I will go check this out and see how i go.  Cheers.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 06, 2018 0