我有以下形式发送PHP数组。 在我的表单中,区域注释的id重复了多少个房间被锁定
表格如下:
<div class="col-xs-4">
<label>Camere</label>
<div class="selector">
<select id='rooms' class="full-width">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
</div>
</div>
<hr>
<!--START-->
<div id="room-1">
<h5 class="title">CAMERA 1</h5>
<div class="row">
<div class="col-xs-4">
<label>ADULTS</label>
<div class="selector">
<select id='adults-1' name="adults-1[]" class="full-width">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
</div>
<div class="col-xs-4">
<label>Copii</label>
<div class="selector">
<select id='kids-1' name="kids-1[]" class="full-width">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
>
</select>
</div>
</div>
</div>
<div class="age-of-children no-display">
<div class="row">
<div class="col-xs-4 child-age-field">
<label>Copil 1</label>
<div class="selector validation-field">
<select class="full-width" name="kidsage-1[]"id='kidsage-1'>
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
</div>
</div>
</div>
</div>
<!--END-->
我需要做些什么? 在响应页面上发送表单后,我需要根据发送到表单的信息构建一个数组结构。 例如:
如果我选择2个房间,我将有以下HTML
**<!--ROOM 1-->**
<div id="room-1">
<h5 class="title">CAMERA 1</h5>
<div class="row">
<div class="col-xs-4">
<label>ADULTS</label>
<div class="selector">
<select id='adults-1' name="adults-1[]" class="full-width">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
</div>
<div class="col-xs-4">
<label>Copii</label>
<div class="selector">
<select id='kids-1' name="kids-1[]" class="full-width">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
>
</select>
</div>
</div>
</div>
<div class="age-of-children no-display">
<div class="row">
<div class="col-xs-4 child-age-field">
<label>Copil 1</label>
<div class="selector validation-field">
<select class="full-width" name="kidsage-1[]"id='kidsage-1'>
<option value="0">0</option>
<option value="1">1</option>
..........................
</select>
</div>
</div>
</div>
</div>
**<!--ROOM 2-->**
<div id="room-2">
<h5 class="title">CAMERA 2</h5>
<div class="row">
<div class="col-xs-4">
<label>ADULTS</label>
<div class="selector">
<select id='adults-2' name="adults-2[]" class="full-width">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
</div>
</div>
<div class="col-xs-4">
<label>Copii</label>
<div class="selector">
<select id='kids-2' name="kids-2[]" class="full-width">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
>
</select>
</div>
</div>
</div>
<div class="age-of-children no-display">
<div class="row">
<div class="col-xs-4 child-age-field">
<label>Copil 1</label>
<div class="selector validation-field">
<select class="full-width" name="kidsage-2[]"id='kidsage-1'>
<option value="0">0</option>
<option value="1">1</option>
..........................
</select>
</div>
</div>
</div>
</div>
<!--END-->
在第一个房间我选择1个成人 在第二个房间我选择了2个成人和1个有1年的孩子
我需要被告知:
// First Room
$rooms[] = array(array("paxType" => "Adult"));
// Second Room
$rooms[] = array(array("paxType" => "Adult"), array("paxType" => "Adult"), array("paxType" => "Child", "age" => 1));
我尝试了不同的方法,但我只能输入成人和儿童,但也不是他们的年龄。我需要outbut如上所述,因为在API SOAP要求上。