<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php form validation Archives -</title>
	<atom:link href="https://mitindia.in/tag/php-form-validation/feed/" rel="self" type="application/rss+xml" />
	<link>https://mitindia.in/tag/php-form-validation/</link>
	<description></description>
	<lastBuildDate>Sat, 26 Nov 2016 06:35:47 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mitindia.in/wp-content/uploads/2023/03/cropped-android-chrome-512x512-1-32x32.png</url>
	<title>php form validation Archives -</title>
	<link>https://mitindia.in/tag/php-form-validation/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PHP-Form validation</title>
		<link>https://mitindia.in/php-form-validation/</link>
		
		<dc:creator><![CDATA[SKB]]></dc:creator>
		<pubDate>Thu, 30 Jun 2016 08:15:15 +0000</pubDate>
				<category><![CDATA[PHP-MySQL]]></category>
		<category><![CDATA[php form validation]]></category>
		<guid isPermaLink="false">http://www.mitindia.in/?p=193</guid>

					<description><![CDATA[<p>In this tutorials, you will be able to understand how form validation are done using php syntax. Step1 : Create a file called &#8220;Validation.php&#8221; and copy the following code and paste into it. &#60;!DOCTYPE HTML&#62; &#60;html&#62; &#60;head&#62; &#60;style&#62; .error {color: #FF00FF;} &#60;/style&#62; &#60;/head&#62; &#60;body&#62; &#60;?php $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name [&#8230;]</p>
<p>The post <a href="https://mitindia.in/php-form-validation/">PHP-Form validation</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="post-title entry-title">In this tutorials, you will be able to understand how form validation are done using php syntax.</p>
<div id="post-body-2401510643577821364" class="post-body entry-content">
<div dir="ltr">
<div>Step1 : Create a file called &#8220;Validation.php&#8221; and copy the following code and paste into it.</div>
<pre>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;style&gt;
.error {color: #FF00FF;}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
$nameErr = $emailErr = $genderErr = $websiteErr = "";
$name = $email = $gender = $comment = $website = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$nameErr = "Name is required";
} else {
$name = test_input($_POST["name"]);
}
if (empty($_POST["email"])) {
$emailErr = "Email is required";
} else {
$email = test_input($_POST["email"]);
}
if (empty($_POST["website"])) {
$website = "";
} else {
$website = test_input($_POST["website"]);
}
if (empty($_POST["comment"])) {
$comment = "";
} else {
$comment = test_input($_POST["comment"]);
}
if (empty($_POST["gender"])) {
$genderErr = "Gender is required";
} else {
$gender = test_input($_POST["gender"]);
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?&gt;
&lt;h2 align=center&gt;Form Validation&lt;/h2&gt;
&lt;center&gt;
&lt;p&gt;&lt;span class="error"&gt;* required field.&lt;/span&gt;&lt;/p&gt;
&lt;form method="post" action="&lt;?php echo
htmlspecialchars($_SERVER["PHP_SELF"]);?&gt;"&gt;
&lt;table frame=box bordercolor=red&gt;
&lt;tr&gt;
&lt;td&gt; Name: &lt;input type="text" name="name"&gt; &lt;/td&gt;
&lt;td&gt; &lt;span class="error"&gt;* &lt;?php echo
$nameErr;?&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; E-mail: &lt;input type="text" name="email"&gt; &lt;/td&gt;
&lt;td&gt; &lt;span class="error"&gt;* &lt;?php echo
$emailErr;?&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; Website: &lt;input type="text" name="website"&gt; &lt;/td&gt;
&lt;td&gt; &lt;span class="error"&gt;&lt;?php echo
$websiteErr;?&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; Comment: &lt;textarea name="comment" rows="5"
cols="40"&gt;&lt;/textarea&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;td&gt; Gender:
&lt;input type="radio" name="gender" value="female"&gt;Female
&lt;input type="radio" name="gender" value="male"&gt;Male
&lt;/td&gt;
&lt;td&gt; &lt;span class="error"&gt;* &lt;?php echo
$genderErr;?&gt;&lt;/span&gt; &lt;/td&gt; &lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt; &lt;input type="submit" name="submit" value="Submit"&gt;
&lt;/td&gt; &lt;/tr&gt;
&lt;/table&gt;
&lt;/form&gt;
&lt;?php
echo "&lt;h2&gt;Your entered data is :&lt;/h2&gt;";
echo $name;
echo "&lt;br&gt;";
echo $email;
echo "&lt;br&gt;";
echo $website;
echo "&lt;br&gt;";
echo $comment;
echo "&lt;br&gt;";
echo $gender;
?&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<div>Step2: see the output, prior to this, please enter some data in the fields and hit &#8220;submit&#8221; button.</div>
<div><img fetchpriority="high" decoding="async" class="aligncenter wp-image-257 size-full" src="https://shivkblog.files.wordpress.com/2015/07/validation.jpg" alt="Validation" width="594" height="324" /></div>
</div>
</div>
<p><a class="a2a_button_whatsapp" href="https://www.addtoany.com/add_to/whatsapp?linkurl=https%3A%2F%2Fmitindia.in%2Fphp-form-validation%2F&amp;linkname=PHP-Form%20validation" title="WhatsApp" rel="nofollow noopener" target="_blank"></a><a class="a2a_button_facebook" href="https://www.addtoany.com/add_to/facebook?linkurl=https%3A%2F%2Fmitindia.in%2Fphp-form-validation%2F&amp;linkname=PHP-Form%20validation" title="Facebook" rel="nofollow noopener" target="_blank"></a><a class="a2a_dd addtoany_share_save addtoany_share" href="https://www.addtoany.com/share#url=https%3A%2F%2Fmitindia.in%2Fphp-form-validation%2F&#038;title=PHP-Form%20validation" data-a2a-url="https://mitindia.in/php-form-validation/" data-a2a-title="PHP-Form validation"><img src="https://static.addtoany.com/buttons/favicon.png" alt="Share"></a></p><p>The post <a href="https://mitindia.in/php-form-validation/">PHP-Form validation</a> appeared first on <a href="https://mitindia.in"></a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
