0

how can filter content with checkbox using php jquery... when i post the form via jquery i get warning undefined index

Here is my js file

function filterContent(){
var all = $(".all").val();
$('input.all').change(function(){


   $.post("filterall.php", {name: all}, function(data){
       alert(data);

   });
  });

  }

HTML CODE

 <table class="table">
 <tr>
 <td><label class="margin pull-left">All</label><input type="checkbox"  value ="all" name="all" class="all"></td>
 <td><label class="margin pull-left">jquery</label><input type="checkbox" name="jquery"></td>

  <td>
  <label class="margin pull-left">HTML</label>
  <input type="checkbox" name="html"></td>
  <td> 
  <td><label class="margin pull-left">Javascript</label>
  <input type="checkbox" name="javascript"></td></td>
  <td><label class="margin pull-left">Php</label><input type="checkbox" name="html"></td>
   <td><label class="margin pull-left">Java</label><input type="checkbox" name="java"></td>


    </tr>
 </table>

PHP CODE

<?php


include 'connection.php';
if(isset($_GET['all'])){
$all = $_POST['all'];
echo "hello".$all;
}

?>

1 Answer 1

2

use if(isset($_POST['all'])){ in your php as you are sending POST request

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.