redarrow Posted March 6, 2011 Share Posted March 6, 2011 This was to match two letters together, 1 was from a post / form,another from a array. it working this way but in_array wouldnt work ... Please can you give an example of in_array, matching a posted letter and a array letter cheers. <?php if(isset($_POST['submit'])){ $quostionb=array("a"); $quostiona=$_POST['quostiona']; if(strstr($quostiona,implode($quostionb," "))){ echo"<p> ansaw is: ".implode($quostionb," ")." "; }else die(); } ?> <form method="POST" action=" "> <select name="quostiona"> <option value="a">a</option> <option value="b">b</option> </select> <input type="submit" name="submit" value="send"> </form> Link to comment https://forums.phpfreaks.com/topic/229808-in_array-wouldnt-work-strstr-did-why/ Share on other sites More sharing options...
Pikachu2000 Posted March 6, 2011 Share Posted March 6, 2011 When issues like that pop up, it's usually due to whitespace present in one of the values, and not the other. Link to comment https://forums.phpfreaks.com/topic/229808-in_array-wouldnt-work-strstr-did-why/#findComment-1183719 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.