How To Allow Only Certain Amount Of Characters In A Web Form PHP HTML
RegisterLogin
How To Allow Only Certain Amount Of Characters In A Web Form PHP HTML
Post Description: How To Allow Only Certain Amount Of Characters In A Web Form PHP HTML
Tags: How, To, Allow, Only, Certain, Amount, Of, Characters, In, A, Web, Form, PHP, HTML
This Post Was Posted On Feb 29, 2008 By web hosting #1214
Post Description: How To Allow Only Certain Amount Of Characters In A Web Form PHP HTML
Tags: How, To, Allow, Only, Certain, Amount, Of, Characters, In, A, Web, Form, PHP, HTML
This Post Was Posted On Feb 29, 2008 By web hosting #1214
How To Allow Only Certain Amount Of Characters In A Web Form PHP HTML by web hosting
I have the same question, but the solution is simple, thanks for the support of the folks at www.webune.com i was able to get this question answer. I do all my web hosting with webune and I am very pleased with their service. The tech at webune said i can do this with PHP. Since i have all my hosting with them, php is standard in all their packages.
so the funtion to use in php to limit the least amount of character a user can enter is the strlen() function.
ok, to follow the contact us form example for the user's name, so once the user submits their name, i would use something like this to check the form to make sure the user's name in 3 or more character long otherwise, the form will fail, so this is the html i would use:
Code:
<!-- ##### BEGIN HTML CODE ##### -->
<form method="post" action="this_file.php">
<p>Name:
<input type="textfield" name="name">
</p>
<p>
<input type="submit" name="submit" value="Submit">
</p>
</form>
<!-- ##### BEGIN HTML CODE ##### -->
<?
###### PHP CODE BEGIN #########
f(strlen($_POST[name]) > 3)
{
echo "Your Name is Valid";
}
else
{
echo "Sorry, Your name must contain atleast three characters;
}
###### PHP CODE END #########
?>
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
©2011 Webune Forums - Thu Dec 22, 2011 12:34 am
Powered by: Webune Forums V3
Powered by: Webune Forums V3