JQuery post to php

Posted by RussP on Stack Overflow See other posts from Stack Overflow or by RussP
Published on 2010-05-04T09:54:59Z Indexed on 2010/05/04 10:18 UTC
Read the original article Hit count: 203

Filed under:
|
|

Why is it that I can never get JQuery serialize to work properly. I guess I must be missing something.

I can serialize a form data and it shows in an alert:

var forminfo = $j('#frmuserinfo').serialize();
alert(forminfo);

I then post to my PHP page thus:

$j.ajax({
  type: "POST", 
  url: "cv-user-process.php",
  data: "forminfo="+forminfo,
  cache: false, 
  complete: function(data) { 

  }
});

But WHENEVER (not the first time) I try to insert/update the data in the DB I only ever get 1 varaible passed:

Here is my PHP script:

$testit = mysql_query("UPDATE cv_usersmeta SET inputtest='".$_POST['forminfo']."' WHERE user='X'");

the data passed only ever gets the first variable. why?

I think it is more the way I deal with the php but it drives me nuts and always takes me far too long to find where I am going wrong.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about serialization