|
|
| |
Home | About Us | Computer & Internet
|
|
|
First off, you're going to learn how to make some simple text-only autoresponders.
To do that, we need to know three easy things: redirection, mail sending, and form submission.
Of course there are more complex autoresponders, like Gary Ambrose's Opt-In Lightning, or Wes Baylock's Mail Master Pro which handle multiple follow-ups and record the e-mail addresses of those who have signed up for the responder.
But today we're just going to focus on how to make a very basic, very simple autoresponder.
Hopefully, you've seen what form fields in HTML look like. Here's some code you can use for an example:
<form action="some-script.php" method="post"> Enter Your E-Mail Address: <input type="text" name="email" size="30"><br> <input type="submit" value="Submit">
Copy and paste this code into a file called "signup.html" and upload it to your web server. You'll see a text box waiting for your visitor to enter his or her email address so they can be sent that autoresponse message. Of course, the form won't work just yet because, if you look at the first line of that HTML code I gave you, you'll see that the form submits to a script called "some-script. php". And we haven't made that just yet.
Look on the second line of "signup.html", at the last half of the line. You should be familiar with HTML tags, but if you're not, an HTML tag consists of two parts: the parent tag and the attributes.
The parent tag is simply the tag's designation. For example, if you had a slice of HTML code that looked like this:
<font face="Verdana" size="1">
Then the parent tag would be "font". The rest of what's enclosed in the tag tells the browser what to do with it. For example, in this tag the attributes are that the font should be Verdana with size 1.
Why am I telling you all this? Because it relates to the HTML code you see in signup.html.
Now, when you look at this:
<input type="text" name="email" size="30">
The code tells the receiving browser that this is an "input" tag, meaning that it's a form field. The name of this item is "email" and its size is 30, meaning this text box should be 30 characters in width.
When the form is submitted, it takes all the values of all the fields inside that form and throws it at its destination. In this case, our destination is "somescript. PHP".
If you're lost, this will all make a whole lot more sense once you try this next step.
Make a file called "some-script.php" and paste this line of code into it:
Upload the script in the same folder as signup.html, and go to "signup.html".
Type your e-mail address in and click the submit button.
You should see a new page containing just your e-mail address and nothing else.
Is this starting to make sense? You told the PHP script to dump the contents of the variable called "email" to the screen, and you just submitted a form with a text box called "email".
If you want to try one more exercise like this, change the name of the text box to, say, "goober" in signup.html and change the $email in some-script.php to $goober. Upload both, go to signup. html, and type anything into the text box. You'll get the same result.
This is how you'll pass data from forms (like text fields, drop down menus, radio buttons and the like) along into the PHP scripts you create.
We've just covered how to submit form elements into PHP. Now let's focus on sending mail.
PHP has a really simple function that uses whatever mail sending program is installed on your server to send messages to the outside world. If you have a crappy web server, this step might not work and you'll have to use a different web host if you want to try this.
But if you're on a good web host that has PHP installed *correctly*, this shouldn't be a problem.
Up until now we haven't used functions in PHP too much, aside from simple things like include() and header(). Today's your lucky day, because functions work in a very similar way to HTML tags. You have the parent tag, and the attributes (or parameters).
The mail() function basically works like this:
mail("recipient","subject","body","headers");
Let's start off by sending a simple e-mail message to yourself. We won't need any special headers this time around, so this will be quick and painless. Copy this one line of code into "mailtest.php":
<?PHP mail("billg@microsoft.com","Hello","Hi. This is the body of my message."); ?>
Replace "billg@microsoft.com" with your actual e-mail address, but be *sure* to keep quotes around it. Save it, and upload mailtest.php to your web server and run it in the browser. You should see a blank page. Wait a few minutes and check your mail. You should see a mysterious mail message in your box with the subject "Hello" and the message "Hi. This is the body of my message."
If you're using a free e-mail service or a weird ISP, the message won't come through because a lot of mail servers these days require that certain headers are present in the message.
Let's do that now.
What's below isn't important enough to explain thoroughly, but it's just header information that is interpreted by the mail server. This data tells us that we're sending a plain text e-mail, that the message came from your e-mail address (and gives your name), and tells us that the e-mail "client" we used was PHP.
$headers = "Content-Type: text/plain; charset=us-ascii\nFrom: $myname <$mymail>\nReply-To: <$mymail>\nReturn-Path: <$mymail>\nX-Mailer: PHP";
This is the code you should have by this point, complete with the header information and the variables which tell the script what your name and e-mail address are:
<?PHP $email = "billg@microsoft.com"; $myname = "Your Name Here"; $mymail = "your@email.here"; $headers = "Content-Type: text/plain; charset=us-ascii\nFrom: $myname <$mymail>\nReply-To: <$mymail>\nReturn-Path: <$mymail>\nX-Mailer: PHP"; mail($email,"Hello","Hi. This is the body of my message.",$headers); ?>
Notice how we've simplified things a bit by using variables in the mail() function. That way we don't have to retype things. This method also looks better (in my opinion anyway) and is easier to tweak once you're ready to actually customize it for yourself.
Try this out again. Believe it or not, but you just made your first autoresponder! Before we move on let's make this look even cleaner:
<?PHP $myname = "Your Name Here"; $mymail = "your@email.here"; $subject = "Hello"; $body = "Hi. This is the body of my message.
Notice how I can continue typing right on the next line!";
$headers = "Content-Type: text/plain; charset=us-ascii\nFrom: $myname <$mymail>\nReply-To: <$mymail>\nReturn-Path: <$mymail>\nX-Mailer: PHP"; if ($email != "") { mail($email,$subject,$body,$headers); } ?>
All I did here was just make things look nicer, but notice how I removed the line that set $email to "billg@microsoft.com." This is because the value of $email will be passed to the script from that form we made earlier.
This also sends the e-mail message ONLY if the value of $email is not blank. So if someone just hit the submit button without entering an address, the script won't try to send the e-mail message.
Everything should be ready for you to try out now. Re-upload "some-script.php" and go to signup. html. Enter your e-mail address in the field, hit submit and wait for that mail message to arrive.
There's only one step left to making this autoresponder complete. And that's sending the user somewhere so they aren't given a blank page.
Find this line in your script:
if ($email != "") { mail($email,$subject,$body,$headers); }
And paste this directly underneath it:
header("Location:http://www.my.host"); die();
Put this in a text file, upload this script and try it out. You'll see that once the autoresponse message is sent, you're directed to www.my.host (or, whatever you end up changing my.host to). Now, go ahead and change it to whatever URL you want to use. Or, use it with a variable so the end result is like this:
<?PHP $myredirect = "http://www.my.host/thankyou.html"; $myname = "Your Name Here"; $mymail = "your@email.here"; $subject = "Hello"; $body = "Hi. This is the body of my message. Notice how I can continue typing right on the next line!"; $headers = "Content-Type: text/plain; charset=us-ascii\nFrom: $myname <$mymail>\nReply-To: <$mymail>\nReturn-Path: <$mymail>\nX-Mailer: PHP"; if ($email != "") { mail($email,$subject,$body,$headers); } header("Location:$myredirect"); die(); ?>
Don't forget to change the values above. "http://www.my.host/thankyou.html" needs to point to the URL where thankyou.html is stored.
You're done.
Assignment
Try this code:
header("Location:mailto:email@my.host?subject=hello");
QUIZ 1. Given this text box in HTML:
<input type="text" name="email" size="30">
If this was submitted to a script using the <form> tags, what would be passed to the script?
A: The variable $email, containing whatever is written in the text box. B: The variable $text, containing whatever is written in the text box. C: The variable $email, containing the value "text". D: The variable $text, containing the value "email".
2. Given this HTML code:
What is the parent tag within this HTML tag?
A: a B: href C: link D: html
3. What does this code do?
header("Location:http://www.simplephp.com");
A: It doesn't do anything, it's a fraud. B: It outputs the text "Location:http://www.simplephp.com" to the browser. C: It redirects to http://www.simplephp.com D: It makes a phone call to http://www.simplephp.com and tells him/her to expect three dinner guests.
4. True or false. This code will execute properly:
<?PHP mail("shitcan@shit.can", "ergonomics" ,"jell-o pudding."); ?>
5. If this was somewhere in the *header* of an e-mail you were sending:
Content-Type: text/plain; charset=us-ascii\n
What would it do?
A: Not allow the message to ever leave U.S. soil. B: Tell the recipient's e-mail client that the message is in plain text. C: It keeps the message from being delivered for 48 hours. D: It's kind of like Rush Delivery, but for e-mail.
|
|
|
To peek at the answers, place your mouse over the Queen with Questions on the right
|
|
|
|
![1.[A] 2.[A] 3.[C] 4.[A] 5.[B]](../../../images/queen_with_question_ty_wht.gif) |
|
|
|
|
However, please try to work out your answers first before peeking at the answers because you will learn a lot better this way.
|
| |
Here is the list of lessons you can learn from the book Simple PHP:
Chapter 1 Site Personalization With PHP Chapter 2 Password Protection With PHP Chapter 3 Autoresponders With PHP Chapter 4 More Autoresponders With PHP Chapter 5 JavaScript Fun With PHP Chapter 6 More JavaScript Fun With PHP Chapter 7 Basic Arrays and PHP Chapter 8 File Handling With PHP Chapter 9 Anything of the Day With PHP Chapter 10 Affiliate Script With PHP Chapter 11 Our Knowledge With PHP Chapter 12 Cookie Fun With PHP Chapter 13 Comparison With PHP Chapter 14 Loops With PHP Chapter 15 A Calendar With PHP Chapter 16 Functions With PHP Chapter 17 Saving With PHP
|
Each chapter uses intuitive, interactive instruction, closing with an assignment to complete before progressing to the next chapter.
As if that wasn't enough, you also get to take a quiz after each lesson and grade it yourself. You will learn why PHP is the preferred choice by programming professionals.
Ever wonder how come your name shows up peppered throughout a sales page or html email? Simple PHP teaches you how to do that.
What about protecting your content with password protection? Or an up to the minute calendar?
Learn how to create your own simple Autoresponder program.
How about this: Have you ever wished you could have one of those neat "Joke of the Day" or "Quote of the Day" features that you see on so many sites? Well, now you can and you'll be amazed at just how simple it is with Simple PHP.
Learning to use Simple PHP on your web site will save you tons of cash in the long run. The conversational tone of the lessons is shear brilliance. These lessons are written just as if you have a tutor sitting right next you, guiding you all the way through.
Having a copy of Simple PHP in your arsenal of tools is a "no-brainer." Just one of the scripts he provides will save you way more than the few dollars you are about to spend to buy your own copy of Simple PHP.
|
|
|
| |
This book retails for $17. However, I will make you a very special offer - you get the following 4 books absolutely free!
|
| |
|
 |
|
You hear the horror stories every day. Crashes, viruses, worms, trojans - where will it end?
Unless you take care of your computer it will end in easily rendering your pc completely useless!
A very expensive lesson to learn!
The alternative is to prepare yourself and insure that you know exactly how to protect yourself from vicious attacks.
The Last Word on eBay. In fact it is alive and kicking and making more and more people wealthy every day. Do you wish you were one of them?
Well, you can be if you're not afraid to get all the answers you will EVER need about eBay and making money.
This is NOT just another "pretty eBay face" wrapped up real nice. Everything you ever wanted to know about eBay is presented with no holds barred. Discover the reason why your first experience with eBay may have been a real embarrassing tragedy.
It truly is possible to make money using the eBay model. But, you'v egot to get started the right way.
Learn how to get an online life. If you are brand new or a disappointed former newbie, you need to read this message very carefully.
If you are (or can remember when you were) someone who is consumed with a desire to have a business on the Internet, that can still become a reality for you.
It's so easy to get frustrated when you first come online with the intention of building a business. Usually, the first thing you come to realize is that if you are to succeed the first order of business is a website.
Maybe you've even joined one of those programs that promises to provide everything for you. You hop on the bandwagon and before you know it, you've spent hours and dollars building and promoting the program owners dreams.
You discover that you are spending your hard-earned cash promoting a website that is exactly like thousands of others! Learning how to build your own is the only sure fire answer to building an online business of your own.
Traffic Secrets: Please, don't be misled by the subject! This is not another redo of the same old information from some cookie cutter wannabe guru who is spouting rehashed information. Nope, this is priceless info from a regular guy just like us.
After spending way too much money on countless numbers of courses he decided enough is enough! His expensive journey allowed him to develop a no holds barred SIMPLE explanation of the ins and outs of search engine traffic.
All those expensive courses are totally worthless if you can't understand them! Well, it really CAN be explained. If you have tried to muddle your way through all that stuff you are in the right place.
Everything is written in easy to understand terms and you'll wish he had written this earlier! Don't waste another minute. You need to discover just how simple search engine optimization can be.
|
|
 |
|
|
|
 |
|
|
 |
|
|
|
Yes, you get all these 5 books for only $17.
Simple PHP + Ezy Internet Safety Guide + Starting Right with eBay + Make Your Own Web Site + Search Engine Traffic Secrets
|
| |
|
|
|
|
|
Immediate download
|
|
|
|
|
|
$17 only for all 5 books
|
|
|
|
|
|
 |
|
|
|
 |
|
|
|
 |
|
|
 |
|
|
 |
|
|
|
|
|
|
|
|
|
|
|
 |
|
|
100% Money Back Guarantee within 8 Weeks
|
|
| |
Your purchase through PayPal is fully secure. Your purchase is also fully guaranteed. If within the next 8 weeks you are not satisfied with your purchase, you can get full refund of your purchase. Whatever your decision, you can still keep all the 5 books. With this iron-clad guarantee, you have everything to gain and nothing to lose. Go ahead and click on the PayPal Buy button. You will be glad you did - guaranteed.
|
| |
|
|
|
|
|
Immediate download
|
|
|
|
|
|
$17 only for all 5 books
|
|
|
|
|
| |
| |
|