Jump to content

in_array wouldnt work? strstr did why?


redarrow

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.