P
P
Petr Volkhanov2015-04-23 19:09:41
PHP
Petr Volkhanov, 2015-04-23 19:09:41

How to get the value of such a form in js or mootools to pass it on to PHP?

c93c6be4435e463487fa5cd0ebf1c980.jpg
Here is its HTML:

<select name="birthdate[day]" id="birthdate-day" class="date_class">
    <option value="0"> </option>
     .....
</select>
<select name="birthdate[month]" id="birthdate-month" class="date_class">
    <option value="0"></option>
    ..........
</select>
<select name="birthdate[year]" id="birthdate-year" class="date_class">
    <option value="0"> </option>
    <option value="2015">2015</option>
     ....
</select>

So I'm trying to get in Mootols, but it doesn't work. What is the correct way to get an array of values ​​into a variable?
var birthdate = $contactForm.getElement('select[name="birthdate"]').getProperty('value');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
acspro, 2015-04-23
@acspro

maybe so

var birthday = {
  'day':document.getElementById('birthdate-day').value,
  'month':document.getElementById('birthdate-month').value,
  'year':document.getElementById('birthdate-year').value
  };
//ну и как то так использовать там alert- просто для примера
alert(birthday['day']);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question