Web Development Information |
|
Newsletter Management Using PHP w/o mySQL for Beginners
Let's begin by setting some limits. If you're like me, you like to keep it simple. All we're doing is collecting email addresses together for our mailing list, so biochemical engineering is out the window. If you're using Thunderbird (or that MS product), you can send nicely formatted newsletters out and retain all of the other awesome features of your email program so there's really no need for databases, logins, or pretty much anything else. We're going to stay far away from anything non-essential. To keep it simple, I'll assume you have Dreamweaver or a comparable WYSIWYG composer; however, if you are editing source code you can click here to see an expanded version of this article with source code. Also, I've assumed that you have an extremely basic familiarity with PHP. If not, please begin by reading this PHP introduction (for absolute beginners). There are only 3 steps we're going to need: 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 create a form with the POST method, a text input named visitor_name, a text input named visitor_email, and a submit button. We now have our excellent mailing list form up and you should check to make sure that it ended up where you planned. At this point, you may need to make another slight change. If the file's extension is not php, php3, php4, or phtml you should change the file's extension to php. Now, you will need to be careful here as file extensions are extremely important, so you may lose functionality when you change the file's extension. If this is the case, look up the extension and find a tutorial for the language. Take a breather and get ready for step 2. Since this is a PHP tutorial, we're going to take a closer look at the PHP code used to send us the email. Being a language, we'll need to learn enough of the PHP vernacular to 1) use the information the user submitted, 2) create the body of the email, and 3) send the email. The form we created sends 2 pieces of information: visitor_name and visitor_email. When PHP receives them it realizes that someone POSTed some information and to make it easy for you to get ahold of it creates a couple of special "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 information that was submitted by your visitor and not some other PHP somewhere on your page. The part in quotes allows you to pick which piece of information was submitted by your visitor (don't stress on the brackets - they just separate the two pieces of information). Great! We now have our visitor's information, so let's send it to ourselves. Sending email in PHP almost seems too easy. We just need to modify this line mail(TO, SUBJECT, MESSAGE); by replacing each of the bold capitalized words and adding this inside of PHP tags to our page. Replace TO with your email address in quotes. Replace SUBJECT with the subject you want to appear on the email inside of quotes. In an effort to keep it simple, replace MESSAGE with "{$_POST['visitor_name']} at {$_POST['visitor_email']} would like to subscribe to your mailing list." By now, the MESSAGE replacement is probably self-explanatory except for the curly braces. The curly braces just reassure PHP that the information inside of them really does refer to something it should already know (in this case what our visitor submitted). Now we just need to include our modified line in the HTML page. Here's the whole modified line (don't forget 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 really observant reader, you're already wondering how PHP knows to wait until someone's submitted a subscription request. Well, in the example above, it doesn't. It's also missing some kind of message to inform your subscriber that their request was successful. Since this is introductory material and already lengthy, I'll save that explanation for another article. Just follow everything you've learned above and use this line of code instead (I've bolded my special addition), substituting the success message 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 receiving emails which you can then add to a mail list in Thunderbird. To manage unsubscription requests, just have a little note at the end of your mailing list saying to reply to the email to be removed and then edit your mailing list. Jeremy Miller - Webmaster of Script Reference - The *NEW* PHP Reference & Tutorial Site For Non-Programmers
MORE RESOURCES: Web Performance Optimization (WPO) Solution Market Set for Exceptional Growth from 2024 to 2032 openPR Where to sell a website? SitePoint Best laptops for programming of 2025 TechRadar Web Design and Development Muskegon Community College StackBlitz achieves $4M ARR in 4 weeks for their AI web development platform with Claude - Anthropic Front End Developer Skills and Responsibilities Simplilearn Rediscover the Joy of Early Web Development With XSLT The New Stack The looming disaster of AI SitePoint 23 In-Demand Full Stack Developer Skills in 2025 Simplilearn Northeastern grad goes from schooling to working full time at web development startup he created Northeastern University How Much does Website Development Cost in 2022? Appinventiv The Rock It! Co. earns Gold Award in Web Development The Post and Courier Best web design software of 2024 TechRadar How do I fix this? SitePoint Latest News: Rising Senior Uses Computer Science Coursework to Thrive in Web Development Role Muhlenberg College From accounting to web development: Meet this Ironhack grad making big strides in programming Refresh Miami Best Website Development Tools for 2024 DesignRush Best PHP Frameworks for Web Development in 2024 Simplilearn 【react roulette】 Português Agência Brasília Best web development tool of 2025 TechRadar Top 10 Front End Languages: A Beginner's Guide Simplilearn CSS5 Features for Faster Web Design Analytics Insight Top Web Design Trends for 2025 Designmodo Top Web Design Trends in 2024 Netguru New Web Development Tool Pulls Design Tokens From Figma The New Stack HTML6 and CSS5: What’s New for Web Developers? Analytics Insight The birth of the Web CERN 11 Applications and Uses of Python in 2025 Simplilearn Best website design service of 2025 TechRadar 38 Web Development Stats You Should Know in 2024 Influencer Marketing Hub Web of Science Research Assistant Clarivate PhyloJS: Bridging phylogenetics and web development with a JavaScript utility library Wiley Online Library 25 Examples Of About Us Pages For Inspiration Search Engine Journal 18 stunning parallax scrolling websites Creative Bloq Best Web Development Bootcamp (2024): Udemy Complete Python Pro Bootcamp Review by Compare Before Buying Business Wire 【react roulette】 Português Agência Brasília 35 Best Web Design Companies 2024 Built In Digital marketing firm inks merger deal with local company The Business Journals How to Use ChatGPT to Build a Website Themeisle |
RELATED ARTICLES
Why Local Service Companies Should Have a Website The Internet is being used by local service business to improve sales today. Sales are improved because a website gives a company more credibility and in some cases generates leads. 3 Rules of Website Designing and Layout Now that you have got your domain name registered, your next worry is about designing a website or getting it designed, depending on your budget,inclination and knowledge.To help the newbie's start it right - Design your website before getting the domain name registered. Beautiful Web Sites Seldom Make More Sales Designing an E-commerce Web site is not as simple as having a "pretty" site that is a pleasure to visit. While it is important to have an attractive site, as much thought must be given to functionality as to appearance. You Dont Know Which One I still remember it very clear .. Why a CSS Website Layout Will Make You Money Although CSS layouts have been around for years, they haven't become so commonplace until recently. This was basically due to limited browser support (especially from Netscape 4) - nowadays though, CSS 2. PHP Redirect A PHP Redirect automatically transfers a web user from one URL to another. For example, typing foo. Disability Discrimination Act (DDA) & Web Accessibility There's been widespread speculation about the new legislation being introduced under the DDA (Disability Discrimination Act), which will ensure that websites are accessible to blind and disabled users. Try to find specific information about it on the Internet and chances are you'll come up empty handed. A Beginners Guide to Server Side Includes An Introduction to Server Side IncludesBeginner? That's OK!While much has been written about Server Side Includes (SSIs -also known as Virtual Includes) much of this information is designed for intermediate to advanced webmasters. This article is aimed at beginners. Building a Great Intranet Taxonomy While it may seem like a "quick and easy" task, defining the navigation structure and organization of your intranet site will be one of the most challenging tasks you will face in the course of your project. It is also one of the most critical success factors. Tell me what your website does! You know exactly what your organisation does and what your website offers its users. This information has probably become second nature to you, but first-time visitors to your site won't know this. Benefits Of An Accessible Website: Part 1 - Increase In Reach The DDA (Disability Discrimination Act) states that service providers must not discriminate against disabled people. A website is regarded as a service and therefore falls under this law, and as such must be made accessible to everyone. Successful Web Development: 10 Key Elements There are many elements that are key to successful web development. There is no arguing that elements of talent such as graphic design, writing, and technical expertise are important. Launch Your Own Website Today - Its Easier Than You Think! Thousands of people are now making a living online and the opportunities are abundant as the Internet continues its growth. An added benefit of running an Internet business is that you can usually start one part-time while you maintain your job and steady income. PIM Team Case Study: Creating Text Effects With PHP and GD See how you can create graphic effects on text with PHP and GD - drop shadows, arcs, fonts and colors.ProblemA-tec Signs and Sraphics Inc. A Website Is Not Enough Your ObjectiveYour small business needs an appealing and professional website but that is just the beginning. If no one visits your website and -- more importantly -- if it does not bring in new customers and allows you to sell more to your current customers, then your site is not effective. Free Websites & Why You Should Avoid Them It amazes me how many people try to build serious websites with free web host providers. Granted, we all love things in life that are marked "free", but it doesn't always make sense to go that route if it will cost you more in the long run. Getting a Web Site Can Be Fast, Easy, and Inexpensive When You Know Your Options So what do you do if need to get a web site but you're not sure how to go about getting one. The good news is you have several options. How Did You Get Here? When marketing your website, it's important to know which of your efforts are producing results and which of them are a waste of time.You can learn a lot about this by analyzing your website's statistics (assuming your webhost offers this service). The Cost Of A Web Site Just starting out, you can start with a simple informational site, which is all most need initially, and build up to a fuller site (e-commerce and/or interactive) when you can afford it.Your goal should be to get an online presence. You Need To Treat Your Website Like An Employee - Heres 5 Ways To Do It People often come to me in a state of crisis and say their website isn't working. Usually they're in a cold sweat:"Mike, give me some practical things I can do to get more sales from my website!"You want practical advice? Stop treating your website like an object in your business and start treating it like an employee. |
home | site map |
© 2006 |