if statements w/ arrays

From: Date: Thu, 26 Oct 2000 21:38:34 +0000
Subject: if statements w/ arrays
Groups: php.general 
Request: Send a blank email to php-general+get-22213@lists.php.net to get a copy of this message
I have a series of checkboxes each with the name: something[] and value is an integer 1-5 based on the answer to this question, I want my scipt to skip to various questions. for example: [snip] if ($Q4 == "done") { echo ("<form action=\"$PHP_SELF\">\n"); echo ("<input type=\"hidden\" name=\"travel\" value=\"1\">"); echo ("<input type=\"hidden\" name=\"Q7\" value=\"done\">"); //Q7 writeQuestions ('7'); include ("q7.inc"); echo ("<p><input type=\"reset\" name=\"Reset\" value=\"クリア\"> <input type=\"submit\" name=\"Submit\" value=\"次へ\"></p>"); echo ("</form>"); } if ($Q7 == "done" && !$party == 5) { echo ("<input type=\"hidden\" name=\"travel\" value=\"1\">"); echo ("<input type=\"hidden\" name=\"Q7\" value=\"done\">"); //Q8 writeQuestions ('8'); echo ("<center><font class=\"contentsBody\">大人</font>"); include ("q7.inc"); echo ("<p><input type=\"reset\" name=\"Reset\" value=\"クリア\"> <input type=\"submit\" name=\"Submit\" value=\"次へ\"></p>"); echo ("</form>"); } elseif ($Q7 == "done") { echo ("<form action=\"$PHP_SELF\">\n"); echo ("<input type=\"hidden\" name=\"travel\" value=\"1\">"); echo ("<input type=\"hidden\" name=\"Q12\" value=\"done\">"); //Q12 writeQuestions ('12'); include ("q12.inc"); echo ("<p><input type=\"reset\" name=\"Reset\" value=\"クリア\"> <input type=\"submit\" name=\"Submit\" value=\"次へ\"></p>"); echo ("</form>"); } [snip] The problem is checkboxes with arrays as their names do not output clean party=5 variables. How can I write: if ($Q7 == "done" && !$party == 5) so that when checkbox party[] == 5 i get a skip. thanks rodney

« previous php.general (#22213) next »