PHP + jQuery - undefined index: , but it still posts successfully?

Posted by Ben Bernards on Stack Overflow See other posts from Stack Overflow or by Ben Bernards
Published on 2012-06-23T03:10:30Z Indexed on 2012/06/23 3:16 UTC
Read the original article Hit count: 199

Filed under:
|

When inserting a record to a database, the server returns an 'undefined index: category', error, but still posts the successfully...

   $('#button).click(function(){
    var newvendor    = $('#input_vendor).val();
        newplantcode = $('#input_plantcode).val();
        newcategory  = $('#input_category).val();

$.post("php/addSite.php",
    {vendor: newvendor, 
     plant_code: newplantcode, 
    category: newcategory}, // <--- Error on this line, for some reason...


     function(result){
            console.log("server returned : " + result);
            [ RELOAD THE PAGE ]
     }

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery