I think this is a very basic question, but I am searching for hours and can't find anything that works :-(

I have a Drupal Webform to collect personal information about my users and send it to another page with Drupal module "Webform Remote Post" (It removes "submitted").

The name attributes of the input tags look like this:

<input name="submitted[address]">

I can use this data in PHP like this:

$address = $_POST['address'];

But the problem are the Date fields. Here the name attributes look like this:

<select name="submitted[dob][day]">

I already tried this:

$day = $_POST['date']['day'];

It always gives a value of "1".

How can I get the day value with $_Post?

Thank you!

Comments

Dirkozoid created an issue. See original summary.

Dirkozoid’s picture

Issue summary: View changes
Dirkozoid’s picture

Title: Post Data » PHP Post Data of a Date Field
Liam Morland’s picture

You can always look at a variable by enabling the devel module and calling dpm(). Then you can see where this is stored.

Dirkozoid’s picture

Category: Support request » Bug report

I created a hidden and disabled field and use javascript to transfer the day to it:

var myday = document.getElementById("edit-submitted-date-day").value; 
        document.getElementById("edit-date-myday").value = myday;

This works, but only for the admin (who has access to the webform results). For normal users the webform isn't submitted. So I can't hide the field with webform, I have to do it with CSS?

Isn't there another solution? This isn't an issue anymore, it's a bug...

Liam Morland’s picture

All parts of a date are submitted with the form.

If you think it is a bug, please provide steps to reproduce the problem, expected behavior, and observed behavior.

Dirkozoid’s picture

I created a text field and set it to 'disabled' and the form is not sent and the submit button keeps disabled for users who don't have result access (everybody except admin in my case). I expected that the form gets submitted.

apaderno’s picture

Issue tags: -$_POST, -PHP

I am removing issue tags used from one to four issues.