# Help needed with contact form code

**URL:** <https://www.phphelp.com/t/help-needed-with-contact-form-code/22976>\
**Category:** PHP Installation and Configuration\
**Created:** [June 27, 2014, 6:25pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976 "2014-06-27T18:25:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![iluvemthik](https://www.phphelp.com/letter_avatar_proxy/v4/letter/i/90ced4/32.png) [@iluvemthik](https://www.phphelp.com/u/iluvemthik)\
**Post date:** [June 27, 2014, 6:25pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/1 "2014-06-27T18:25:09Z")

</div>

Hi, i’m having trouble getting my form to work. When pressing the send button, there is no response at all unless the fields have not been field out then it will give you required field message. So any help is appreciated.

The form code:

## Say Hello!

Fields marked \* are mandatory. NOTE: Contact Forum is disabled for now, Please use e-mail link to your left.

\*This is not a valid name. \*This field is required.\*This is not a valid email address. \*This field is required.\*This is not a valid phone number. \*This field is required. Message \*The message is too short. \*This field is required.
Contact form submitted!  
**We will be in touch soon.**

[send](#work%20box)[clear](#work_box)

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [June 27, 2014, 6:58pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/2 "2014-06-27T18:58:58Z")

</div>

Remove the brackets

action="\<email.php\>"

To

action=“email.php”

---

<div class="post-metadata">

**Author:** ![iluvemthik](https://www.phphelp.com/letter_avatar_proxy/v4/letter/i/90ced4/32.png) [@iluvemthik](https://www.phphelp.com/u/iluvemthik)\
**Post date:** [June 27, 2014, 7:01pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/3 "2014-06-27T19:01:31Z")

</div>

sweet! Thanks bro!

---

<div class="post-metadata">

**Author:** ![iluvemthik](https://www.phphelp.com/letter_avatar_proxy/v4/letter/i/90ced4/32.png) [@iluvemthik](https://www.phphelp.com/u/iluvemthik)\
**Post date:** [June 27, 2014, 7:17pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/4 "2014-06-27T19:17:41Z")

</div>

> [@Kevin Rubio](#):
>
> Remove the brackets
> 
> action=“\<email.php\>”
> 
> To
> 
> action=“email.php”

Hey Kevin, i removed the brackets but still no response from the form. Here is my action code is everything proper with it?

\<?php // EDIT THE 2 LINES BELOW AS REQUIRED $send\_email\_to = "....@....com"; $email\_subject = "message from my site"; //GET FIELDS FROM YOUR HTML FORM, THE NAME PROPERTY IS PASSED IN THE $\_POST ARRAY //E.G IF YOU HAVE A FIELD WITH name="email" YOU'LL GET THE VALUE IN PHP SCRIPT //LIKE BELOW $email = $\_POST['email']; $name = $\_POST['name']; $phone = $\_POST['phone']; $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= "From: ".$email. "\r\n"; /\*Customize your message here\*/ $message = " **Email =**".$email."  
"; $message .= " **Name =**".$name."  
"; if(!empty($phone)) $message .= " **Phone =**".$phone."  
"; $message .= " **Message =**   
"; @mail($send\_email\_to, $email\_subject, $message,$headers); header('Content-type: text/json'); $return\_array['success'] = '1'; echo json\_encode($return\_array); die(); ?\>

---

<div class="post-metadata">

**Author:** ![benanamen](https://www.phphelp.com/user_avatar/www.phphelp.com/benanamen/32/287_2.png) [@benanamen](https://www.phphelp.com/u/benanamen)\
**Post date:** [June 27, 2014, 7:26pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/5 "2014-06-27T19:26:50Z")

</div>

Your “Submit” code doesnt work.

Try this:

---

<div class="post-metadata">

**Author:** ![iluvemthik](https://www.phphelp.com/letter_avatar_proxy/v4/letter/i/90ced4/32.png) [@iluvemthik](https://www.phphelp.com/u/iluvemthik)\
**Post date:** [June 27, 2014, 7:44pm UTC](https://www.phphelp.com/t/help-needed-with-contact-form-code/22976/6 "2014-06-27T19:44:35Z")

</div>

Kevin, still nothing.
