You are here: Form validation « PHP Programming Language « IT news, forums, messages
Form validation

Posted by Jerim79 on 11/10/06 21:00

I am looking into form validation for my HTML form. I don't want to use
javascript and was looking into using PHP. A crazy thought crossed my
mind and I just wanted to get some input.

What if I basically made the form one long if/then statement? I could
ask for the first piece of information, test it against some
conditions, then if it is okay I allow the user to fill in the next
piece of information. I could go do down the page validation each box
as we go. I could use hidden on all the text boxes until the previous
condition had been validated. Some pseudocode:

<?php
<form action=POST method=registered.php>
<input name"Fname" type="text">
if ($Fname meets some condition)
{
<input name="Lname" type="text">
if ($Lname meets some condition)
{
<input name="Number" type="text>
if ($Number meets some condition)
{
}
}
}
else;
echo "Please enter a phone number";
else;
echo "Please enter a valid last name";
else;
echo "Please enter a valid first name";
?>

I know the code isn't exact, I am just theorizing here. Could such a
thing be done? Even remotely similar? I don't really plan on doing this
anytime soon, but I was just curious. I only started PHP programming a
few days ago so no need to point out how stupid this may sound.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация