html form

Soldato
Joined
2 Oct 2004
Posts
4,362
Location
N.W London
hi there,

whats the code I need so that when you click on the "submit" button on a html form, it emails the company and changes the web page from the form to a thank you we received your email page?

please help

thanks

p.s. im using dreamweaver cs5 but I do know basic coding, its been ages since i done this so need a helping hand

thanks
 
Ideally you'll need to have some server side code (either ASP or PHP) to handle the form submission and take care of the emailing side of things for you. The code you'll need will depend on what your hosting provider supports. A quick google should then gives you some pointer on exactly how it works.

Failing that there is another method where you set the form action to be an email address, which I've coded below, however this will throw up security warnings in most browsers and is generally a very very bad idea unless you have literally no other option.

Code:
<form method="post" action="mailto:[email protected]?subject=Email+from+my+website">
    <label for="field1">Field #1</label>
    <input type="text" name="field1" id="field1" />

    <label for="field2">Field #2</label>
    <input type="text" name="field2" id="field2" />

    <button type="submit">Send the email</button>
</form>
 
You can set mailto: as the form action, that would require no back end scripting but is a pretty rough and ready way of doing it.
 
mailto: if I am correct will open up there preferred email application and not necessarily submit the form and then take them to a "thank you enquiry received" page will it?

cant remember but I know there is a way it can be done using html...

edit: mailto works but as stated ^^^^^^^^ not as I intend it to work...
 
I can't recall any way of doing it the way you are describing without some sort of server-side interaction occuring.
 
is there no way of doing it using HTML only and not .asp or .php?

i thought there was?
If what xirokx and SMB have said is correct, then no. There is no other way than to use server side code.

I've just had a quick google for 'form to email service' and there appears to be lots on offer. Not sure if you have to pay or what setup they have, but that's a possible route.

It's much easier to code it yourself though. 10 lines of code tops.
 
could someone very kind then help?

I have everything done already the 2 forms and the 2 pages that should appear when you click on "submit" form

I just need to link it up, my host supports .asp

pleasssssssssssssssseeeeeeeeeeeeeeeeeeeeeeeeeeeee
 
Back
Top Bottom