Hey, I have a website with a contact form but i am struggling with the 'Submit' side of things. I really need the button to push the information to one of my emails. Please help!
This is my code (its all on an html page)...
<form action="#" id="contact-form">
<fieldset>
<div class="wrapper">
<div class="success"> Contact form submitted! <br> <strong class="color-1">We will be in touch soon.</strong> </div>
</div>
<div class="field">
<label class="name">
<input type="text" value="Name:">
<span class="error">*This is not a valid name.</span> <span class="empty">*This field is required.</span>
</label>
</div>
<div class="field">
<label class="email">
<input type="text" value="Email:">
<span class="error">*This is not a valid email address.</span> <span class="empty">*This field is required.</span>
</label>
</div>
<div class="field">
<label class="phone">
<input type="tel" value="Phone:">
<span class="error">*This is not a valid phone number.</span> <span class="empty">*This field is required.</span>
</label>
</div>
<div class="area">
<label class="message">
<textarea>Message:</textarea>
<span class="error">*The message is too short.</span> <span class="empty">*This field is required.</span>
</label>
</div>
<div class="clear"></div>
<div class="buttons-wrapper">
<a href="#" class="button" data-type="reset">Clear</a>
<a href="#" class="button" data-type="submit">Send</a>
</div>
</fieldset>
</form>
I was told to add this code to the bottom of it, but it didnt help.
The PHP code requires:
a) That the "action" points to the same page. I'm not sure if "#" will work, but it might.
b) That the file extension is ".php" not ".html".
c) It is run on a server. I.e. You can't run it locally in your browser (as you can html).
d) You should also add error checking to prevent the "mail" command being triggered inappropriately. As it stands it will trigger an email every time the page is accessed or refreshed!!!
P.S. Just tested the "#" and it works. I've learned something today ;)
09-08-2012, 07:38 AM
benshapsx
Still not working
Hi,
I have tried this on a server already and nothing worked, i also tried changing the page to .php and still nothing :(
09-08-2012, 10:38 AM
jedaisoul
Are you trying it on a web server, and is php and php mail enabled?
09-08-2012, 12:01 PM
jackoconnell
The form is an html page, the form action points to a form to mail php processor on your server. If processor is not there nothing happens.
Many free php form to mail scripts available on line.
The ones that offer html response and/or attachment capibilities a little shakey.