Hi, everyone I have a issue I cant seem to figure out. I am trying to count how many fields are not NULL or empty.
the form that I have that post this script has the field name n1,n2,n3 ect...
The reason for this script is to see how many questions are answered.
If anyone can help I would love it so much thanks :)
for ($i=1; $i<count($_POST ) ; $i++)
{
$varname = "n$i";
if( ! isset( $_POST[$varname] ) ) break;
$val = $$varname;
// $question_answe red = count($_POST);
if(strlen($val) > 0 )
{
$test = array($val, $varname);
echo $val."<br />";
// echo $varname."<br />";
$question_answe red = sizeof( $_POST ) != (strlen($val) > 0 );
}
}
echo $question_answe red."<br />";
the form that I have that post this script has the field name n1,n2,n3 ect...
The reason for this script is to see how many questions are answered.
If anyone can help I would love it so much thanks :)
for ($i=1; $i<count($_POST ) ; $i++)
{
$varname = "n$i";
if( ! isset( $_POST[$varname] ) ) break;
$val = $$varname;
// $question_answe red = count($_POST);
if(strlen($val) > 0 )
{
$test = array($val, $varname);
echo $val."<br />";
// echo $varname."<br />";
$question_answe red = sizeof( $_POST ) != (strlen($val) > 0 );
}
}
echo $question_answe red."<br />";
Comment