Reputation: 2468
Really newbie question :)
I have a form that is:
<form class="contactform">
<input class="text" type="text" name="store_signup_form[name]" />
<input type="submit" class="but" value="Try it!" />
</form>
If im post the data like this:
$.ajax({
url: urlsendMail,
type: 'post',
data: $('.contactform').serialize()
...
How can get these variables in PHP? Im trying but is not working:
$email = $_POST["store_signup_form'[name]'"];
Thanks
Upvotes: 0
Views: 81
Reputation: 460
Try $_POST["store_signup_form[name]"]
or $_POST["store_signup_form"]["name"]
.
Upvotes: 0
Reputation: 227240
Doing name="store_signup_form[name]"
is how you send arrays in POST data. PHP handles this as such. That means that $_POST['store_signup_form']
is actually an array! So, you can just do:
$email = $_POST['store_signup_form']['name'];
Upvotes: 4