Simple newsletter subscription form template

Hello guys,

I'm looking for a simple but not archaic email subscription template - one box for entering an email and a button for submitting.

I can handle html, css and some jquery proficiently but doing ajax validation on the user side + php script which should actually send user entered email to my email address is too much beyond my skill right now.

There's always a template, do you have some links please?
LVL 1
Fajer39Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Please have a look at this article.  I believe that it contains all of the explanation and code samples you would need to get started.  There is no AJAX involved (and none needed).  Please post back if you have any questions, ~Ray
http://www.experts-exchange.com/Programming/Languages/Scripting/PHP/A_3939-Registration-and-Email-Confirmation-in-PHP.html
0
Marco GasiFreelancerCommented:
Here you find all parts: the php script called sendmail.php, the javascript script called sendmail.js (what a fantasy, uh?); and the html page, maybe sendmail.html?

Feel free to ask you need some further help.

php side:
		$name = $_POST['name'];
		$email = $_POST['email'];
		$message = $_POST['message'];
		$to = 'email address here';
		$subject = 'Newletter subscribing';
		$headers = "From: " . strip_tags($email) . "\r\n";
		$headers .= "Reply-To: ". strip_tags($email) . "\r\n";
		$headers .= "MIME-Version: 1.0\r\n";
		$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
		if (mail($to, $subject, $message, $headers))
		{
			echo 'Thank you for subsribing';
		}
		else
		{
			echo 'Ooops, an error occurred on the server.';
		}

Open in new window


html
<!DOCTYPE html>
<html lang="en">
	<head>
           <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
           <script src='sendmail.js'></script>
        </head>
       <body>
	<div id="response"></div>
	<form role="form">
		<input type="text" id="name" placeholder="Your name" />
		<input type="email" id="email" placeholder="Your email" />
		<textarea id="message" cols="30" rows="10" placeholder="Your message"></textarea>
		<button id="send" >Send</button>
	</form>
       </body>
      </html>

Open in new window


jquery
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script>
     $(document).ready(function(){
	$( document ).on( 'click', '#send', function ( e ) {
		e.preventDefault();
		$( '#response' ).hide();
		$( '#privacy' ).css( { "border": "none" } );
		var name = $( '#name' ).val();
		var email = $( '#email' ).val();
		var message = $( '#message' ).val();
		if ( name === '' || email === '' || message === '' )
		{
			return;
		}
		$.ajax( {
			type: 'post',
			url: 'sendmail.php',
			data: { name: name, email: email, message: message },
			success: function ( result )
			{
				$( '#response' ).html( result ).fadeIn( 'slow' ).delay( 3000 ).fadeOut( 'slow' );
				$( '#name' ).val( '' );
				$( '#email' ).val( '' );
				$( '#message' ).val( '' );
			},
			error: function ( result )
			{
				console.log( 'result' );
			}
		} );
	} );
   
     });
</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Fajer39Author Commented:
Thank you very much guys.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Servers

From novice to tech pro — start learning today.