We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies. Learn More
contact@techquestworld.com
+919547614783
Premium Article
Published 5 months ago

Modern PHP Newsletter Subscription Form with Stylish Design

5 min read
117 views
Modern PHP Newsletter Subscription Form with Stylish Design
Photo by Techquestworld

A minimal PHP-powered newsletter form to collect email addresses, designed with a clean, modern look using HTML and CSS.

newsletter.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Subscribe | PHP Newsletter Form</title>
<meta name="description" content="A stylish PHP newsletter form with modern CSS design.">
<meta name="keywords" content="PHP, newsletter, email form, html css form, stylish php form">
<style>
body {
background: #f9f9f9;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.newsletter-box {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 6px 15px rgba(0,0,0,0.1);
width: 300px;
text-align: center;
}

.newsletter-box h2 {
margin-bottom: 20px;
font-weight: 600;
}

input[type="email"] {
width: 100%;
padding: 10px;
border: 1px solid #ddd;
border-radius: 5px;
margin-bottom: 15px;
}

button {
width: 100%;
padding: 10px;
background: #4caf50;
border: none;
color: white;
font-size: 16px;
border-radius: 5px;
}

button:hover {
background: #45a049;
}
</style>
</head>
<body>

<form class="newsletter-box" action="subscribe.php" method="post">
<h2>Subscribe Now</h2>
<input type="email" name="email" placeholder="Enter your email" required>
<button type="submit">Subscribe</button>
</form>

</body>
</html>

subscribe.php

<?php
if (isset($_POST['email'])) {
$email = trim($_POST['email']);
$file = fopen("subscribers.txt", "a");
fwrite($file, $email . PHP_EOL);
fclose($file);
echo "Thank you for subscribing!";
}
?>
Author
TAPAS SAHOO

Developer by Profession, Techie by Heart

A curious mind with a love for writing and technology, dedicated to simplifying web development and programming topics while keeping up with the ever-changing tech landscape.

Discussion (0)

Replying to
Previous Article
Simple Contact Form in PHP with Email Functio...

Build a working contact form using PHP that sends form data via email. A great beginner PHP project...

Next Article
Simple Feedback Form with PHP Email Support

Send feedback directly to your inbox using this beautifully designed PHP form.

Related Articles

Simple Contact Form in PHP with Email Functionality – Step-by-Step Guide
PHP
Simple Contact Form in PHP with Email Functionalit...

Build a working contact form using PHP that sends form data via email. A great beginner PHP project...

Simple Feedback Form with PHP Email Support
PHP
Simple Feedback Form with PHP Email Support

Send feedback directly to your inbox using this beautifully designed PHP form.

Build a Complete PHP CRUD App with Bootstrap – No Framework
PHP
Build a Complete PHP CRUD App with Bootstrap – No...

Looking to build a full web app in PHP without relying on Laravel or CodeIgniter? This step-by-step...

Pessimistic vs Optimistic Locking in Laravel: A Developers Deep‑Dive
Pessimistic vs Optimistic Locking in Laravel: A De...

Learn how to safeguard your Laravel applications from race conditions by applying the right concurre...