[eluser]jplanet[/eluser]
I am sure many of you have successfully accomplished this:
I have a simple form where customers can edit their address. I can query the database for the customer address and populate all of the fields with:
Code:
$this->load->model('customer_model');
//return row with address data
$billing = $this->customer_model->getBilling($this->session->userdata('customer_id'));
////set validation rules etc.
$this->validation->set_fields($fields);
$this->validation->bill_first_name = $billing->first_name;
$this->validation->bill_last_name = $billing->last_name;
$this->validation->bill_company_name = $billing->company_name;
$this->validation->bill_address = $billing->address;
$this->validation->bill_city = $billing->city;
This all works beautifully. But, when I get to the state dropdown, no luck:
Quote:$this->validation->bill_state = $billing->state;
There is no state selected even through $billing->state returns a value that has a match in the form.
My state dropdown looks like this (abbreviated):
Code:
<select name="bill_state" id="bill_state">
<option value="" selected>Select a State</option>
<option value="AL" <?= $this->validation->set_select('bill_state', 'AL'); ?>>Alabama</option>
<option value="AK" <?= $this->validation->set_select('bill_state', 'AK'); ?>>Alaska</option>
<option value="AZ" <?= $this->validation->set_select('bill_state', 'AZ'); ?>>Arizona</option>
<option value="AR" <?= $this->validation->set_select('bill_state', 'AR'); ?>>Arkansas</option>
<option value="CA" <?= $this->validation->set_select('bill_state', 'CA'); ?>>California</option>
<option value="CO" <?= $this->validation->set_select('bill_state', 'CO'); ?>>Colorado</option>
<option value="CT" <?= $this->validation->set_select('bill_state', 'CT'); ?>>Connecticut</option>
<option value="DE" <?= $this->validation->set_select('bill_state', 'DE'); ?>>Delaware</option>
etc...
Any suggestions would be appreciated!