我正在追逐處理一個HTML表單的挑戰,這個表單的輸入字段是使用包含多個選擇字段的JavaScript DOM動態創建的。這裏是形式的示例代碼,我有:如何使用PHP處理包含動態muliselect字段的HTML表單?
<input type="text" name="attributeIndex[]" id="brand" class="form-control" placeholder="brand">
<select name="attributeIndex[]" id="color" class="form-control">
<option value="92">Aero</option>
<option value="277">Aluminum</option>
<option value="91">Amber</option>
</select>
提交表格後,我想在一個PHP數組像這樣的表單數據:
$formData=$_GET['attributeIndex'];
數組$ FORMDATA應該是像這樣:
array(
[0]=>text input value here
[1]=>array(list of selected colors here)
)
任何建議將不勝感激!