View Full Version : How do I?
clairemackaness
29th December 2005, 16:00
I want to put a little box on my website that will allow people to submit their e-mail address to me so I can add them to my mailing list for a newsletter etc.
Can anyone give me the HTML for this so I can paste it into front page?
I want it to look like this:
Subscribe to my free newsletter to find out about sales, exhibitions and other interesting snippets of news.
[Box to enter email adress] [SUBMIT BUTTON]
Coding Monkey
29th December 2005, 16:12
Do you just want the information e-mailed to you to insert manually?
crus
29th December 2005, 16:22
Hi Claire,
your hosting is it asp or php?
As you will need a form to capture the data effectiverly.
D
clairemackaness
29th December 2005, 16:32
I want it sent to my inbox on my e-mail, I'll insert it manually for now.
No idea about the hosting, I'm not technical at all!
Coding Monkey
29th December 2005, 16:43
Do you know who you're hosted with? Would need to know to be able to write the form for you. No point writing it in PHP if it's not supported, as it won't work
clairemackaness
29th December 2005, 16:54
evohost theres a link to them on my links page, I have the business package.
clairemackaness
29th December 2005, 17:56
Did you find what you wanted?
Rob Holmes
29th December 2005, 17:59
Claire I can offer a free newsletter system to you if you like.
It's at http://www.ecust.co.uk
The free version has a sponsored link to UKBF at the bottom of the email.
It generates the signup code for you to cut and paste into your website.
Rob
clairemackaness
29th December 2005, 18:17
Thanks for the offer Rob, but I am really only after collecting e-mail addresses on my user friendly excel database. I'm only going to send stuff out once in a blue moon or when theres something good to say.
I've tried a few of these automated systems, but I prefer to keep it in house.
crus
29th December 2005, 18:45
OK,
PHP :-)
Heres a quick and dirty solution that should, work, Ive ha d a couple of wines mind ;-)
On the pages you want the subscribe box to be
>>> (basic form no validation)
<form id="emailSubscribe" action="emailSubscribe.php" method="post" target="_new">
<input type="text" id="email" value="">
<input type="submit" value="subscribe">
</form>
<<<
then create a new text file and paste this into it changing the $to variable to your email and then save and upload as emailSubscribe.php
>>>
<?
$to = "change to your email address"; // the email address to send the subscription to
$email = mysql_escape_string($_POST["email"]); // grab the email address entered
mail($to, "Subscribe", $email); // send the email to yourself
?>
<html>
<head>
<script type="javascript/text">
function subscribeAlert() {
alert('Thankyou!\n\nThe email address <?=$email;?> has been added to our mailing list.');
}
</head>
<body onload="javascript:subscribeAlert();self.close();">
</body>
</html>
<<<
Watch out for the forum wrapping the comments after the thre $ php bits!
clairemackaness
29th December 2005, 19:08
AAAAAAAAAAAhhhhh sounds mad, can you put the bits in for me so I can just copy and paste? I'm not an HTML whizz, infact I never use it.
crus
29th December 2005, 19:13
Hi Claire,
Ok the only bit you need to change is the
$to = "change to your email address"; // the email address to send the subscription to
line
so its something like
$to = "daniel@nuguru.com"; // the email address to send the subscription to
otherwise just paste the bit between the first >>> <<<'s to the page you want the form box on and then the bit between the second >>> <<<'s to a new txt file as instructed.
Any good?
D
Coding Monkey
29th December 2005, 19:36
Crus, mysql_escape_string is deprecated and is used to prevent SQL injection. There's really no need for it on an e-mail form, and if you did wish to use it, addslashes() would make more sense. If you wanted to work security into it, using regex would be a more sensible idea.
crus
29th December 2005, 19:49
old habits die; hard...
said was dirty,
regular expressions used to be really slow, forget were in php 5 now,
I think there used to be a reason for using mysql_escape_string() as opposed to addslashes to control input data, can't remeber waht it was now, possibly double slashing.
Might be time for
Daniel Mullin (depreciated) ;-)
Either that or a flick through the latest security threads, seen you on phpsecure.
As I say, it was more force of habit, than concious attempt to lock down the input data.
clairemackaness
29th December 2005, 19:51
oh my gosh, I've started a coding war!
crus
29th December 2005, 20:08
LoL,
more a lover than a fighter :shock:
D
Coding Monkey
29th December 2005, 20:10
A diplomatic resolution
crus
29th December 2005, 20:18
Damn, I must be drunk to be diplomatic!
Good christmas Tom?
seen the thread, about nunchucks.co.uk, might need a skin done?
D
Coding Monkey
29th December 2005, 20:30
Everyone's on holiday, meaning I can't work! Rubbish Christmas! Never again!
bwglaw
29th December 2005, 20:44
My fault...;) he was doing my personal website
Coding Monkey
29th December 2005, 20:45
Ah, but that gave me something to do. Highlight of my Christmas
bwglaw
29th December 2005, 21:00
Feel free to publish the site to show off your good design skills when you said you were not a web designer...its good in my view. Can you translate latin? :P
Coding Monkey
29th December 2005, 21:11
If either of my designers came back with that, I would have fired them on the spot, then set Nic on them :D
No idea about Latin, but I've a friend at Cambridge who can
bwglaw
29th December 2005, 21:41
Ah, but Nic is 'inviting' not 'intimidating' ;)
clairemackaness
29th December 2005, 21:53
All sorted now, thanks to all