...

View Full Version : Help with email signup (single textbox emailed to myself)



cb2004
12-07-2010, 03:01 PM
On each page of my website I have a form, I want this to be the users email sent to my email. So far I have this but no joy on the send part. What am I doing wrong.


<form action="" method="post">
<?php
$sent = $_POST['newsletter'];
if (!$sent) {
echo '<input name="newsletter-email" type="text" id="wo" />
<input type="image" name="newsletter" id="wogo" src="img/wogo.png" />';
}
elseif ($sent) {
echo 'Sent';
}
?>

</form>

muneeba9071
12-07-2010, 03:05 PM
Try this,

<form action="" method="post">
<?php
$sent = $_POST['newsletter'];
mail("you@yoursite.com","Subject","{$sent}");

if (!$sent) {
echo '<input name="newsletter-email" type="text" id="wo" />
<input type="image" name="newsletter" id="wogo" src="img/wogo.png" />';
}
elseif ($sent) {
echo 'Sent';
}
?>

</form>

Change the e-mail address in the code and that's it.

cb2004
12-07-2010, 03:17 PM
I receive a blank email but the 'Sent' text does not appear.

muneeba9071
12-07-2010, 03:19 PM
Try this,


<form action="" method="post">
<?php
$sent = $_POST['newsletter'];
if($_POST) {
mail("you@yoursite.com","Subject","{$sent}");
}

if (!$sent) {
echo '<input name="newsletter-email" type="text" id="wo" />
<input type="image" name="newsletter" id="wogo" src="img/wogo.png" />';
}
elseif ($sent) {
echo 'Sent';
}
?>

</form>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum