Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Submitting a form with HTML
Old 05-17-2006, 05:33 PM Submitting a form with HTML
Junior Talker

Posts: 3
Trades: 0
I am all very new to html coding could you please help, On my website I have a form with a submit button,
I have added this line to send it to my email address it does work, however when the person who fills the form out presses "submit" it tries to retrieve their email address from outlook, and I dont want this to happen, I do not want their e-mail address if you know what I mean!

<form name="form1" method="post" action="MAILTO:****@*********.co.uk" enctype="text/plain">

Could You please help me!
Dave Parky is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-17-2006, 05:38 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think you need a server side scripting language like php or asp to do what you want.

I'll generally submit my form and set the form action to go to a thank you page. On that thank you page will be my php code to send out the email.

I don't believe it can be done with html alone if you don't want their email client open
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-17-2006, 05:53 PM Re: Submitting a form with HTML
Junior Talker

Posts: 3
Trades: 0
|Thank you for the quick response, I guess this is another language I have to try and master, is php easy to understand like HTML?
Dave Parky is offline
Reply With Quote
View Public Profile
 
Old 05-17-2006, 06:07 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
It's a programming language as opposed to a markup language so it's a little more complicated, but not a really difficult language to learn. The mail part is pretty simple though I'd suggest reading a little bit about php before just diving in.

A good place to start reading is probably W3Schools. I set the link so it goes directly to the php tutorial. You can find everything at http://www.php.net/ but the site can be confusing at first.

The function you ultimately want to use is the mail() function. The function itself is easy to use. Just spend a little time reading up on what you need to do to get php working in general first.

php isn't the only language to do this in either. asp or asp.net among others will also work. Chances are you're webhost will already have php installed though.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by vangogh; 05-17-2006 at 11:54 PM..
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 05-17-2006, 06:23 PM Re: Submitting a form with HTML
Junior Talker

Posts: 3
Trades: 0
You are a genius, I have sorted my problem out, I found a website called vision Internet? they had a step by step instructions of how to write it, and it works perfect! http://www.visn.co.uk/form-mail.html Thank you for your much needed help.
Dave Parky is offline
Reply With Quote
View Public Profile
 
Old 05-17-2006, 11:55 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
Glad I could help point you in the right direction Dave.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 07-21-2006, 04:35 PM Re: Submitting a form with HTML
Novice Talker

Posts: 10
Name: vernon
Trades: 0
Sorry to but in to your conversation but I have been having the same problem.

I have followd the stes to create a form that posts to e-mail and have created a form: http://www.theoldexchange.com/form.htm
it sends to thanks.php however when used it says it cant find it and yet it is there if you click 'try again' it takes you to the page but the e-mail does not get sent.
Do you have any ideas ?
vernon08 is offline
Reply With Quote
View Public Profile
 
Old 07-21-2006, 04:54 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I just tried your form and got the same result you described. Could you post the code for thanks2.php? I'll need to see the code on that page to before being able to determine what's wrong.

Firefox is giving a different message when submitting the form. I get "The requested method POST is not allowed for the URL /thanks2.php."
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 07-21-2006, 05:37 PM Re: Submitting a form with HTML
Novice Talker

Posts: 10
Name: vernon
Trades: 0
Thanks for looking at this for me. Thanks very much. The code for thanks.php is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>thanks</title>
</head>
<body>
Thanks for submitting your enquiry
<script language="php">
$email = $HTTP_POST_VARS[email];
$mailto = "mail@theoldexchange.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
reset ($HTTP_POST_VARS);
$mailbody = "Values submitted from web site form:\n";
while (list ($key, $val) = each ($HTTP_POST_VARS)) { $mailbody .= "$key : $val\n"; }
if (!eregi("\n",$HTTP_POST_VARS[email])) { mail($mailto, $mailsubj, $mailbody, $mailhead); }
</script>
</body>
</html>
vernon08 is offline
Reply With Quote
View Public Profile
 
Old 07-21-2006, 06:07 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
I think the problem is you found some old sites to create that PHP.

First the way I will typically turn php on and off within the page is:

<?php
your php code here
?>

Next the $HTTP_POST_VARS array has been deprecated in newer versions of php. You can use $_POST instead so:

$name =$_POST["name"];
$email=$_POST["email"];
$mailto = "mail@theoldexchange.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";

mail($mailto, $mailsubj, $name, $mailhead);

You won't need to use the while loop since only one name and email will be submitted each time. That should work and send you the persons name in the body of the email.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 07-21-2006, 06:38 PM Re: Submitting a form with HTML
Novice Talker

Posts: 10
Name: vernon
Trades: 0
Thanks again. I have updated the html, but still cannot get it to work, would you say that my interpretation of what you said was right:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>thanks</title>
</head>
<body>
Thanks for submitting your enquiry
<?php
$name =$_POST["name"];
$email=$_POST["email"];
$mailto = "mail@theoldexchange.com";
$mailsubj = "Form submission";
$mailhead = "From: $email\n";
?>
</body>
</html>
vernon08 is offline
Reply With Quote
View Public Profile
 
Old 07-21-2006, 08:20 PM Re: Submitting a form with HTML
Junior Talker

Posts: 2
Name: Chris Farrugia
Trades: 0
I hate to scare you here, but your script could get you in some trouble. The problem is with something called "header injection." Definitely google that. Basically, people can exploit PHP's mail function to send spam. It happened to me when I wrote a little script that does something similar. You need to check your form for things like %0E, Content-type, etc.

You can find a lot more by googling that phrase. If you start getting a ton of spam in your inbox, that'll be the first tip that you're a victim of malicious spammers.
__________________
Chris Farrugia

Please login or register to view this content. Registration is FREE
ChrisF79 is offline
Reply With Quote
View Public Profile Visit ChrisF79's homepage!
 
Old 07-21-2006, 08:47 PM Re: Submitting a form with HTML
vangogh's Avatar
Post Impressionist

Latest Blog Post:
Why Responsive Design?
Posts: 10,815
Name: Steven Bradley
Location: Boulder, Colorado
Trades: 0
vernon, it looks like you just forgot the mail() function:

mail($mailto, $mailsubj, $name, $mailhead);

That's the part that will actually send the mail. Chirs is right though about the header injection and spam. I wanted you to get the form working first before mentioning the security aspect.
__________________
l Search Engine Friendly Web Design |
Please login or register to view this content. Registration is FREE

l Tips On Marketing, SEO, Design, and Development |
Please login or register to view this content. Registration is FREE

l
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
vangogh is offline
Reply With Quote
View Public Profile Visit vangogh's homepage!
 
Old 07-21-2006, 09:55 PM Re: Submitting a form with HTML
angele803's Avatar
Perfectly Imperfect

Posts: 1,772
Name: Stephanie
Location: Oklahoma
Trades: 2
Quote:
Originally Posted by Dave Parky
I am all very new to html coding could you please help, On my website I have a form with a submit button,
I have added this line to send it to my email address it does work, however when the person who fills the form out presses "submit" it tries to retrieve their email address from outlook, and I dont want this to happen, I do not want their e-mail address if you know what I mean!

<form name="form1" method="post" action="MAILTO:****@*********.co.uk" enctype="text/plain">

Could You please help me!
I just wanted to interject something here...maybe it isnt relevent, but I just wanted to let you know that you werent completely wrong in the code you first tried to use. Back in the day, that is how you would have done things. But since browsers have changed and since scripts like php and asp have become popular, the script is the way to do things now. Anyway, I hope all of your problems get solved soon. I am fairly new to PHP myself. I took a class and have a basic overall understanding, but as far as specifics goes, I know nothing!!! lol! Just wanted to tell you that you werent doing anything REALLy wrong when you tried the 'ole "mailto" method.
angele803 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Submitting a form with HTML
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 2.15135 seconds with 12 queries