button to send an email

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Dear all,
I'm completely new to PHP but I think this is the right language to
solve my problem and I hope you can help me.

I want to add a form to my webpage to ask for an email address and the
submit button should send to such an address a preformed email.

I can write the form as

   <form method="POST" enctype="text/plain">
   e-mail: <input type="text" name="to">
   <input type="submit" value="Get Result">

but I'm not able to get the data written in the form and prepare the
message using such data as the To: field of the message and of course I
can't send the message as well.

I imagine I've to write a PHP script to put on a server but I can't
write it and especially I don't know how to pass the data from the
webpage to such script.

Could you help me?

Thank you



Re: button to send an email

On 10/2/2012 10:58 AM, Jack of Hearts wrote:
Quoted text here. Click to load it

this could help you.


Das Abspringen einer Begrenzungsmauer dient nicht dem direkten
Zurücklegen des Arbeitsweges.

Re: button to send an email

Markus Sonnenberg wrote:

Quoted text here. Click to load it

W3Schools.com in its current state is the cause for massive unlearning
later, and there is no indication that this could change.  BTW, it has
nothing to do with the W3C.  Avoid it if possible.

Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

Re: button to send an email

Jack of Hearts wrote:

Quoted text here. Click to load it

I've always liked this example.


Do be aware that your form could be used by malcontents, who could enter
someone else's email address for spamming and annoyance purposes. In my
email forms, I always have the form just send mail to me, then I reply
manually to the visitor. This may or may not fit your needs.

   -This space for rent, but the price is high

Re: button to send an email

Beauregard T. Shagnasty wrote:
Quoted text here. Click to load it

I also look at it from the users point of view and then decide what
might be the best solution.

At work we use several forms between departments. The advantage is that
it is easy to fill out, people get the information in the same layout
and this impoves effeciency. Also it avoids information being forgotten,
e.g. account numbers or other information.

As an Internet user, I want to have what I send in my send items. Forms
does not offer me this ability. So a 'mailto' link is a better solution.
It can sill fill out the subject, so it is easy to filter. You can even
add your standard body.

Obviously with php these can be generated and can include e.g. cookie
information, so you have some way of knowing who the mail came from if
that is of importance.

It is also a LOT easier to do.

If you do decide on forms, rather use two different forms then one that
can handle two issues. See that there is as little information as
possible that needs to be filled out.
e.g. if people must be logged in, you do not need to ask their username
or email as you mhave that already.
Ask only information that is relevant and try not to have any 'free
entry' text fields. The complexer they become, the more people will use
it wrongly and the more counter productive they will become.

http://www.alistapart.com/articles/inline-validation-in-web-forms/ is
interesting as well.

How do you ask a man to be the last man to die in Iraq?
How do you ask a man to be the last man to die for a mistake?

Re: button to send an email

houghi wrote:

Quoted text here. Click to load it

Mailto: perhaps in *addition to* a form. Never *instead of* a form. (for
normal public websites). Remember, with the proliferation of hotmail/gmail/
whoohoo only users, many people no longer even have a mail client for a
mailto to work.

   -This space for rent, but the price is high

Site Timeline