Current location: Hot Scripts Forums » General Web Coding » HTML/XHTML/XML » How to email from a submit button of a filled form in HTML

How to email from a submit button of a filled form in HTML

Reply
  #1 (permalink)  
Old
New Member
 
Join Date: Aug 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
How to email from a submit button of a filled form in HTML

I have a code and i want that when some one fill the form and hit the submit button the data of form must email at the desired email address.
please help me:...........

Quote:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="35" colspan="2" align="left" valign="top" class="About_text">Form</td>
<tr>
<td width="35%" align="left" valign="top" class="form_text" style="padding-left:16px;">Your Name*</td>
<td width="65%" height="30" align="left"><span style="padding-left:17px;">
<input name="textfield2" type="text" class="text_box" id="textfield2" size="30" />
</span></td>
</tr>
<tr>
<td align="left" valign="top" class="form_text" style="padding-left:16px;">Email ID* </td>
<td height="30" align="left" valign="top"><span style="padding-left:17px;">
<input name="textfield" type="text" class="text_box" id="textfield" size="30" />
</span></td>
</tr>
<tr>
<td align="left" valign="top" class="form_text" style="padding-left:16px;">Phone </td>
<td height="30" align="left" valign="top"><span style="padding-left:17px;">
<input name="textfield4" type="text" class="text_box" id="textfield4" size="30" />
</span></td>
</tr>
<tr>
<td align="left" valign="top" class="form_text" style="padding-left:16px;">Interested In</td>
<td height="30" align="left" valign="top"><table width="92%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="12%" align="left" valign="top" class="check_box"><input type="checkbox" name="checkbox3" id="checkbox3" /></td>
<td width="88%" align="left" valign="top" class="form_text">SPORTS</td>
</tr>
<tr>
<td align="left" valign="top" class="check_box"><input type="checkbox" name="checkbox4" id="checkbox4" /></td>
<td align="left" valign="top" class="form_text">EDUCATION</td>
</tr>
<tr>
<td align="left" valign="top" class="check_box"><input type="checkbox" name="checkbox5" id="checkbox5" /></td>
<td align="left" valign="top" class="form_text">TELEVISION</td>
</tr>
<tr>
<td class="check_box">&nbsp;</td>
<td align="left" valign="top" class="form_text">&nbsp;</td>
</tr>
<tr>
<td align="left" valign="top" class="check_box">&nbsp;</td>
<td align="left" valign="top" class="form_text">&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top" class="form_text" style="padding-left:16px;"><span class="form_text" style="padding-left:16px;">Comments</span></td>
<td height="30" align="left" valign="top"><p style="padding-left:14px;">
<textarea name="textarea" class="text_box" id="textarea"></textarea>
</p>
<p style="padding-left:14px;">
<label>
<input type="submit" name="SUBMIT" id="SUBMIT" value="send" />
</label>
</p></td>
</tr>
</table>
</body>
</html>

Last edited by bizzar528; 08-12-10 at 09:15 AM. Reason: Added code tags...
Reply With Quote
  #2 (permalink)  
Old
Yeroon's Avatar
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 24 Times in 23 Posts
Hi,

Can you only use html? You don't have any scripting language available? Like PhP, ASP?

If it's just HTML you can use, it can't be done (as far as I know).

/Yeroon
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #3 (permalink)  
Old
New Member
 
Join Date: Aug 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
try this

For your button's to work to send into an e-mail u need some php coding to be placed into the work i have placed some below this might help you out with some change's but if you need some more help i will be happy to help out
PHP Code:

         <?php
              $me 
=$_SERVER['REQUEST_METHOD'];
              if (
$_POST['mail']=='' && $me =="POST") {
                  
$me="";
                  
$em="*";
                  
$name =stripslashes($_POST['name']);
                  
$telephone =stripslashes($_POST['telephone']);
                
$companyname =stripslashes($_POST['companyname']);
                
$enquiry =stripslashes($_POST['enquiry']);
                  
$message =stripslashes($_POST['message']);
              }
            if (
$me != 'POST' ){
    
?>

Last edited by job0107; 08-28-10 at 03:40 AM.
Reply With Quote
  #4 (permalink)  
Old
UnrealEd's Avatar
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 27 Times in 27 Posts
it is possible, but rarely done. Instead of telling a form to submit the data to a page, you can submit it to the default mail client.

HTML Code:
<form method="post" action="mailto:default@domain.com">

</form>
If a user doesn't have his mail client configured (like myself), he can't send a mail. Like Yeroon and 1dannyboy2 pointed out, you should use server sided languages to do so, as it allows you to mail almost anything, and you have more control over what is being sent.
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #5 (permalink)  
Old
Newbie Coder
 
Join Date: Apr 2010
Posts: 22
Thanks: 36
Thanked 0 Times in 0 Posts
Use PHP to do this,,,

<?php
$to = "recipient@example.com";
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
if (mail($to, $subject, $body)) {
echo("<p>Message successfully sent!</p>");
} else {
echo("<p>Message delivery failed...</p>");
}
?>

on form submit make this code work.
__________________
PHP
Reply With Quote
  #6 (permalink)  
Old
New Member
 
Join Date: Oct 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
mysamsung, can i add a php code just like that in the .html file? sorry if its a stupid question but i dont know nothing about php
Reply With Quote
  #7 (permalink)  
Old
UnrealEd's Avatar
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 27 Times in 27 Posts
You can, but it won't be parsed as php, rather as plain text. To make it actually work, you need a server that runs php and you have to set the extension of the file to .php
__________________
"Good judgement comes from experience, and experience comes from bad judgement." - Fred Brooks

Reply With Quote
  #8 (permalink)  
Old
Newbie Coder
 
Join Date: Apr 2011
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,
I came across a script which you require. I think it will be appropriate.
It is PHP Contact Form. You can fill the all the details and when you hit the submit button, the details get delivered. I found in hscripts.com. Code was downloadable but I checked out only the demo. Give it a try.
Reply With Quote
  #9 (permalink)  
Old
New Member
 
Join Date: Apr 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Abitha View Post
Hi,
I came across a script which you require. I think it will be appropriate.
It is PHP Contact Form. You can fill the all the details and when you hit the submit button, the details get delivered. I found in hscripts.com. Code was downloadable but I checked out only the demo. Give it a try.
Hey this is exactly what I need! I want to share a page with a emailto link without installing third party plugins... what is the adress of this script?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Email form with PHP once submit is clicked the php script is disaplayed utailor PHP 2 07-26-10 05:13 PM
ajax checking and onsubmit issue follower JavaScript 4 10-12-08 03:45 PM
ASP: Sending a HTML form to an email address cancer10 ASP 1 02-09-07 06:09 PM
submit email form drogue PHP 2 02-12-06 03:23 PM
form to anyone's email with Image Verification ghostrider632 PHP 1 05-11-05 09:08 AM


All times are GMT -5. The time now is 11:16 AM.
vBulletin® Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.