Receiving data from Ajax

I am receiving this string from Ajax to PHP

Response is yes and data is firstname=John&lastname=Smith&email=myemail%40gmail.com&phone=123-444-4444

How would I assign these values to some variables in the most efficient way rather then doing this…

$firstname = $_POST['username'];

In what way is that inefficient?

I didnt mean it that it is inefficient…i was just wondering if there is another way?

It doesnt seem that my data is being passed to php…

when I do this…

      $firstname = $_POST['firstname'];
      if ($firstname = "John"){
          echo "Yes";
      }

I am not getting success back to Ajax…

EDIT: My code had a typo.Works now

This one?

if ($firstname = "John"){

Yes it works now. I had typo there

Technically you might extract() them… although it’s explicitly advised not to extract user data.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.