Hi, A small problem here but I can't get this to work... A pair of fresh eyes will help. I've got an array (with 15 elements) like this: $array_nl_data = array(1,0,1,0,0,0,0,0,0,0,0,0,0,0,0); Code (markup): I want - depending on the value in $array_nl_data - to call a different function: function callForm($num){ $i = $num - 1; if($array_nl_data[$i] == 0){ callText($num); echo "result: ".$array_nl_data[$i]; }elseif($array_nl_data[$i] == 1){ callRadio($num); echo "result: ".$array_nl_data[$i]; } } Code (markup): This code only executes callText(). Isn't it supposed to call callRadio() on $array_nl_data[0] and $array_nl_data[2] ?
Two things: If you are subtracting 1 from $num, you will never get a 1, always a 0 or -1. You also need to pass the function array_nl_data to the callForm function, as the array is not global and the function has no way of knowing what it is.