Quote:
Originally Posted by bananalive
php for hook before form submit
PHP Code:
if ($q[4] && (empty($q[5]) || empty($q[6]))) { $complete = false; if (empty($q[5])) $iqs[] = 5; if (empty($q[6])) $iqs[] = 6; }
|
Thank you again bananalive, it worked exactly as I asked. You Da Man!
However, I didn't think it through all the way.
What I really needed was if 'any' of the three question were used, then the other two would have to be filled in too.
So I just repeated the code and changed the q#'s around like this
Code:
if ($q[4] && (empty($q[5]) || empty($q[6])))
{
$complete = false;
if (empty($q[5])) $iqs[] = 5;
if (empty($q[6])) $iqs[] = 6;
}
if ($q[5] && (empty($q[4]) || empty($q[6])))
{
$complete = false;
if (empty($q[4])) $iqs[] = 4;
if (empty($q[6])) $iqs[] = 6;
}
if ($q[6] && (empty($q[4]) || empty($q[5])))
{
$complete = false;
if (empty($q[4])) $iqs[] = 4;
if (empty($q[5])) $iqs[] = 5;
}
and it works ok.
But I'm wondering if this is the proper way to do it for each set of questions, or if it should be written a different way.
Thanks again for your help. *nominated for Mod of Month*