If you do not need me, for this you need to add ON d.uid=e.uid" something like this ON d.uid=e.uid" AND Uid=$id AND name=$name And m_atm=$atm or add this to where (to where I feel bad)
for instance
HTML:
<form method="get" action="/a.php"> <input type="checkbox" name="check1" value="text1"/> <input type="checkbox" name="check2" value="text2"/> <input id="submit" onclick="f();return false;" type="button" value="ok"/> </form>
PHP (test.php)
if(isset($_GET['check1'])) $id=" AND Uid='$_GET[check1]'"; //if is checked first if(isset($_GET['check2'])) $name=" AND name='$_GET[check2]'"; //if is checked second /* . . . */ $sql = "SELECT e.* ,d.* FROM emitra_basic As e INNER JOIN emitra_device as d ON (d.uid=e.uid $id $name )"; var_dump($sql);
JS:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script> function f() { var url; var xmlhttp, url="/text.php?"+$('form').serialize(); </script>
This php code is simple, but you can use the loop and key value to make it look better
For example, you can use <input name=text[]> for all ckeckboxes elements and do this
foreach ($_GET['text'] as $key => $value) { if($key==0) $key='uid'; else if($key==1) $key='name'; else if($key==2) $key='m_atm'; $q.="$key='$value' AND "; } $q=substr($q,0,strlen($q)-5); $sql2 = "SELECT e.* ,d.* FROM emitra_basic As e INNER JOIN emitra_device as d ON (d.uid=e.uid $q )"; var_dump($sql2);
source share