last day (14 days later) » 

12:23 PM
0
Q: check if is an array for each value

bob jomesI have three input boxes: <form method="post"> <input type="text" name="1"> <input type="text" name="2"> <input type="text" name="3"> <input type="submit" name="submit"> </form> When the user clicks submit, I would like to check if the inputted value appears in an array only if the...

 
array_serach('432423',$array);
 
yes but how do i do it for each input only if theyre not empty
 
use foreach($_POST as $row) { if(!empty($row)) { array_serach($row,$array); } }
 
how does that use the if statement?
 
check out my edited comment
 
12:23 PM
hello again. but that checks if the submit button has an array value
hi
 
please let me explain details
 
ok
 
explain what is your need ?
 
So I have 3 input boxes
When the user clicks submit, if the input box is not empty, I need to check if whatever is typed in it appears in the array.
If for all of them what is typed appears in the array, i want 'yes' to be echoed.
if not for all of them what is typed appears in the array, i want 'no' to be echoed
 
first case setup required attribute for not empty field
 
12:30 PM
what do u mean?
 
<input type="text" name="1" required >
 
but none of them are requirede
required*
 
oh okay
foreach($_POST as $row) { if(!empty($row)) { if(array_serach($row,$array)){ echo "yses"; }else { echo "NO"; } } }
 
but i dont want 'yes' or 'no' to be echoed for each one
also it checks if the submit button has the same value as the array
 

last day (14 days later) »