Web-development informational articles

Newsletter management using php w/o mysql for beginners - web-development

 

Let's begin by locale some limits. If you're like me, you like to keep it simple. All we're doing is collecting email addresses all together for our mailing list, so biochemical commerce is out the window. If you're using Thunderbird (or that MS product), you can send nicely formatted newsletters out and hang on to all of the other awe-inspiring skin texture of your email course so there's especially no need for databases, logins, or attractive much no matter which else. We're going to stay far away from everything non-essential.

To keep it simple, I'll believe you have Dreamweaver or a as good as WYSIWYG composer; however, if you are bowdlerization cause code you can click here to see an delayed account of this critique with font code. Also, I've tacit that you have an exceedingly basic familiarity with PHP. If not, entertain begin by appraisal this PHP introduction (for absolute beginners).

There are only 3 steps we're going to need:

  • Put HTML on the page to assemble the user's name and email address.
  • Add in a barely PHP and (possibly) alter a filename.
  • Receive and course the emails.
  • Marching on, we need to put some HTML on our page to let the visitor enter in their name and email address. To do this using Dreamweaver, you'll need to build a form with the POST method, a text input named visitor_name, a text input named visitor_email, and a accept button.

    We now have our admirable mailing list form up and you ought to check to make sure that it ended up where you planned. At this point, you may need to make a further feeble change. If the file's augmentation is not php, php3, php4, or phtml you be supposed to alter the file's addition to php. Now, you will need to be assiduous here as file extensions are enormously important, so you may lose functionality when you alteration the file's extension. If this is the case, look up the extension and find a tutorial for the language.

    Take a breathing space and get ready for step 2. Since this is a PHP tutorial, we're going to take a more rapidly look at the PHP code used to send us the email. Being a language, we'll need to learn an adequate amount of of the PHP argot to 1) use the in sequence the user submitted, 2) build the body of the email, and 3) send the email.

    The form we produced sends 2 pieces of information: visitor_name and visitor_email. When PHP receives them it realizes that a big name POSTed some in order and to make it easy for you to get ahold of it creates a combine of distinctive "things" you can use to refer to what the user entered: $_POST['visitor_name'] and $_POST['visitor_email']. Why does it call them by funny names? Well the $_POST part assures you that it was in rank that was submitted by your visitor and not some other PHP anywhere on your page. The part in speech marks allows you to pick which piece of in rank was submitted by your visitor (don't stress on the brackets - they just break free the two pieces of information).

    Great! We now have our visitor's information, so let's send it to ourselves. Carriage email in PHP approximately seems too easy. We just need to adapt this line mail(TO, SUBJECT, MESSAGE); by replacing each of the bold capitalized words and accumulation this contained by of PHP tags to our page. Put back TO with your email adopt in quotes. Change SUBJECT with the area under discussion you want to arrive on the email contained by of quotes. In an endeavor to keep it simple, exchange MESSAGE with "{$_POST['visitor_name']} at {$_POST['visitor_email']} would like to subscribe to your mailing list. " By now, the MESSAGE substitute is almost certainly self-explanatory but for the curly braces. The curly braces just reassure PHP that the in sequence contained by of them certainly does refer to a little it be supposed to previously know (in this case what our visitor submitted).

    Now we just need to bring in our adapted line in the HTML page. Here's the whole custom-made line (don't not recall the PHP tags!):

    mail("MY EMAIL ADDRESS","Newsletter Subscription","{$_POST['visitor_name']} at {$_POST['visitor_email']} would like to subscribe to your mailing list. ");

    If you're a exceedingly perceptive reader, you're previously wondering how PHP knows to wait until someone's submitted a subscription request. Well, in the exemplar above, it doesn't. It's also gone some kind of implication to bring up to date your subscriber that their apply for was successful. Since this is introductory cloth and previously lengthy, I'll save that details for a further article. Just admire the whole lot you've academic above and use this line of code as a replacement for (I've bolded my exclusive addition), substituting the achievement letter for one of your own:

    if (isset($_POST['visitor_email'])) { mail("MY EMAIL ADDRESS","Newsletter Subscription","{$_POST['visitor_name']} at {$_POST['visitor_email']} would like to subscribe to your mailing list. "); echo "Subscription Complete. Thank you!"; }

    Er, that's all folks! You'll start getting emails which you can then add to a mail list in Thunderbird. To administer unsubscription requests, just have a a small amount note at the end of your mailing list aphorism to reply to the email to be distant and then edit your mailing list.

    Jeremy Miller - Webmaster of Script Reference - The *NEW* PHP Citation & Tutorial Site For Non-Programmers


    MORE RESOURCES:
    Web development: A gap in education  Tennessee Tech Oracle








































    What Is Web Design?  Technology Zimbabwe



























    The Future of Web Development  Business 2 Community

































    Developed by:
    home | site map
    goldenarticles.net © 2020