public function dcr() {
$query = $this->db->query("SELECT * FROM church_repo");
foreach ($query->result() as $row) {
$data = array('churchName' => $row->church_name,
'streetAddress' => $row->street_address,
'locationalState' => $row->locational_state,
'locationalZIP' => $row->locational_zip,
'locationalCountry' => $row->locational_country,
'locationalCity' => $row->locational_city,
'overseerAccountId' => $row->overseer_account_id,
'taxExemptionNumber' => $row->tax_exemption_number,
'accountStatus' => $row->status,
);
$this->load->view('admin-request', $data);
}
}
In my Html I am outputting the above Php. Also in my Html, I have two buttons that have id's of 'pass' and 'fail'. What the script is doing when I have multiple rows is output those two buttons with the same id's on each outputted row. That's good, because it is doing what it needs to be doing, but now I'm not able to identify the outputted rows. So I need to be able to match each button set with the outputted Php. Any ideas?
The way i typically do what you are attempting is by creating new forms for each row. and including a hidden input field in each row with the id.
ReplyDelete<input type="hidden" name="row_id" value="<?= $overseerAccountId;?>"/>
when the user clicks pass/fail you simply use CI/PHP to get that value
<?php
echo $this->input->post('row_id');
//do work son.
?>
the only difference between your code and what i typically do, is i move my foreach into the view and iterate through each row creating new <tr><td> instead of creating new tables like you are doing. But this could be considered against the MVC standard