I am new in OOP PHP and I am still learning, I have a form where name of locations is populated through JQuery/HTML form using drop-down field with same name, my problem is when I try to insert in mysql database, I did not get the selected value,
<div id="NCR" class="drop-down-show-hide">
<div class="field">
<label for="region"> NCR </label>
<select name="region" id="ncr region">
<option value="">-- Choose --</option>
<option value="1"> Region 1 </option>
<option value="2"> Region 2 </option>
<option value="3"> Region 3 </option>
</select>
</div>
</div>
<div id="CAR" class="drop-down-show-hide">
<div class="field">
<label for="field"> CAR </label>
<select name="region" id="car region">
<option value="">-- Choose --</option>
<option value="4"> Region 4 </option>
<option value="5"> Region 5 </option>
<option value="6"> Region 6 </option>
</select>
</div>
</div>
<div id="region3" class="drop-down-show-hide">
<div class="field">
<label for="region"> CAMANABA </label>
<select name="region" id="camanaba region">
<option value="">-- Choose --</option>
<option value="7"> Region 7 </option>
<option value="8"> Region 8 </option>
<option value="9"> Region 9 </option>
</select>
</div>
</div>/HTML
PHP
if(Token::check(Input::get('token'))){
$validate = new Validate();
$validation = $validate->check($_POST, array(
'apz_account' => array(
'required' => true
),
'api_account' => array(
'required' => true
),
'wupos_tid' => array(
'required' => true
),
));
if($validation->passed()){
// check APZ account
$agent = DB::getInstance()->get('agent', array('apz_account', '=', Input::get('apz_account')));
if(!$agent->count()){
// check API account
$agent = DB::getInstance()->get('agent', array('api_account', '=', Input::get('api_account')));
if(!$agent->count()){
$agent = new Agent();
try {
$agent->createAgentAccount(array(
'apz_account' => Input::get('apz_account'),
'api_account' => Input::get('api_account'),
'wupos_tid' => Input::get('wupos_tid'),
'region' => Input::get('region'),
'registered' => date('Y-m-d H:i:s'),
));
// print_r($agent);
// Session::flash('success', 'You have registered successfully.');
// Redirect::to('../../index.php');
} catch(Exception $e){
die($e->getMessage());
}
} else {
echo Input::get('api_account'), ' account is already exists';
}
} else {
echo Input::get('apz_account'), ' account is already exists';
}
} else {
foreach ($validation->errors() as $error) {
echo $error, '<br>';
}
}
}
Please advice. Thank you