Quick Question
Posted: Sun Aug 17, 2008 8:18 pm
Hey everyone,
I'm very new to PHP, but I've been exploring with it and I've found it to be very interesting so far, to say the least. My latest 'project' has been trying to make a forum in which you fill out text boxes. But my problem is with telling which boxes have been filled in or not. Here's my code: (not posting the body)
For some reason the variable '$notfilled' always returns eight, but I want it to return the number of fields left blank. If anyone can help me, that'd be great. Thanks.
I'm very new to PHP, but I've been exploring with it and I've found it to be very interesting so far, to say the least. My latest 'project' has been trying to make a forum in which you fill out text boxes. But my problem is with telling which boxes have been filled in or not. Here's my code: (not posting the body)
Code: Select all
<?
if($_POST['submit'])
{
$stuff = array("username","password","firstname","lastname","country","state","town","zip","email");
$i = 0;
$notfilled = 0;
while ($i < <!-- s8) --><img src=\"{SMILIES_PATH}/icon_cool.gif\" alt=\"8)\" title=\"Cool\" /><!-- s8) -->
{
if($_POST[$stuff[i]] != NULL)
{
//it's all good....
}
else if($_POST[$stuff[i]] == NULL)
{
$notfilled++;
}
$i++;
}
if($notfilled > 0)
{
//echo "One or more fields were not filled out. Please fill them in to continue.";
}
echo $notfilled;
}
?>