0% found this document useful (0 votes)
8 views2 pages

Practical 12 (A)

The document presents a PHP program designed to validate email addresses through a web form. It includes HTML code for the form and PHP code that checks the email format using a regular expression. If the email is valid, it confirms form submission; otherwise, it prompts the user to enter a valid email address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views2 pages

Practical 12 (A)

The document presents a PHP program designed to validate email addresses through a web form. It includes HTML code for the form and PHP code that checks the email format using a regular expression. If the email is valid, it confirms form submission; otherwise, it prompts the user to enter a valid email address.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Subject :- Web Based Application Development with PHP Subject Code :- 22619

Name :- Shivam Sainath Korpakwad Batch :- CO 6 IA Roll No. 24


Program Code :-
1) Write a simple PHP program to check that emails are valid.
CODE :-
<html>
<body>
<form action="index.php" method="POST">
<label for="email">Email</label>
<input type="textl" name="email"><br>
<label for="password"> Passwordl</label>
<input type = "textl" name = "password"><br>
<input type = "submit" value = "Submit">
</form>
</body>
</html>
<?php
$pattern = '/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/';
If($_SERVER["REQUEST_METHOD"] == "POST")
{
if (!preg_match($pattern, $_POST['email']))
{
echo "Enter the valid email address";
}
else{
echo "Form submitted";
}
}
?>

OUTPUT :-

You might also like