ok I need help figuring this loop crap out.
I have a select that is made from a loop. no problem there. once the select it selected then it make inputs from how many was selected form the select statement. no problem there. my problem is on the <inputs> tages. the name I have to use is an array.. something like this name= something[].
now when the values are inputed into the input statements how do I put them in another loop?
I looked in the source of the page and the name for the all the inputs is resistor[]. now I know that nothing is there yet as there is nothing in the text box. put once there get occupied how do I get them out into the above code?PHP Code:function multiresist($i){
$myCalculator = new ScientificCalculator();
$vr = array("R1","R2","R3","R4","R5","R6","R7","R8");
$vs = array("vr1","vr2","vr3","vr4","vr5","vr6","vr7","vr8");
//$vr1 = $myCalculator->multiply($i,$r1);
//$vr2 = $myCalculator->multiply($i,$r2);
//$vr3 = $myCalculator->multiply($i,$r3);
//$vr4 = $myCalculator->multiply($i,$r4);
//$vr5 = $myCalculator->multiply($i,$r5);
//$vr6 = $myCalculator->multiply($i,$r6);
//$vr7 = $myCalculator->multiply($i,$r7);
//$vr8 = $myCalculator->multiply($i,$r8);
for ($counter=1; $counter<8; $counter++){
$vs[$counter] = $myCalculator->multiply($i,$resistor[$counter]);
echo "<br><b>$vr[$counter]</b> = $vs[$counter]";
}
now the loop on the bottom works but I get R1=0. so I know the values from the text inputs aren't getting up to it. duh! I know that I ain't even calling it yet, that is where I am stuck.
the commented lines is what I need to make into an loop/array.
I have half of it working but can't the values from the text boxes.




Reply With Quote