/    Sign up×
Community /Pin to ProfileBookmark

HELP! making a form for submitting an e-mail address

I want to make this simple one input form, but since mailto doesn’t work the way I want it to, and I don’t know PHP or CGI, what should I do!

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@VernonKJun 04.2005 — If you have PHP support on your server it is very easy. You can throw the below in the page (must have .php extension) and it'll work for you![code=php]
<?php
//let's see if the form was filled out
$filled = $_POST['filled'];

if($filled) {

//who should this be sent to?
$mail_to = '[email protected]';

//what is the eMail subject?
$subject = 'eMail Subject Line';

//what should the message be?
$msg = "
Someone recently submitted their eMail address:

eMail Address: {$_POST['email']";

//use visitors eMail add'y as From
$from = $_POST['email'];

//actually mail the form input
$form_send = mail("$mail_to", "$subject", "$msg", "From: $from");

}

else {
//the form wasn't filled out yet, so let's display it!
?>
<form name='contactform' action='file.php' method='post'>
What is your eMail Address:<input type='text' name='email' id='email'>
<input type='submit' name='submit' value='send form'>
</form>
<?php
} //end else[/code]
×

Success!

Help @katrostar spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...