Need to achieve on a page a.html input scores or school numbers passed to another PHP file b.php query the corresponding number or score.
From a webpage to the file pass student number Stunum, score grade, hide form flag flag
The b.php code is as follows:
$value) {if ($num = = $key) {$searchFlag =1; $result = $value;}}} else{$num =$_request[' Grade '];foreach ($grade as $key = = $value) {if ($num = = $value) {$searchFlag =2; $result []= $key;}}} if ($searchFlag ==0) {echo "no this object";} else if ($searchFlag ==1) {echo ' number is '. ' $num "." Student scores are: "." $result ";} Else{echo "score is". " $num "." The student number is: "; Var_dump ($result); foreach ($result as $key = + $vaule) {echo" $key "." ";}}? >
Through the score to find the study number, enter 45, there is a corresponding two number, with an array to save, through the var_dump display is correct, array ([0] = 1 [1] + 5)
But with the following foreach traversal, the $key value is 0,1, but the $value is 68, 68.
For advice
Reply to discussion (solution)
11 lines of if ($num = = $key) is that right?
can only be obtained without this object
In addition your study number, results are taken from $grade =array (23,45,65,87,95,45,32,84,54,68);
How to distinguish who is who?
Sorry, not clear, study number I am directly using the default of 0-9, equivalent to $key equivalent to the school number. $num is transmitted from other pages, indicating the number of queries, as long as the match with $key will be the corresponding $value output. There is no such object
。。。。。。 You know, $value variable name is wrong.