I have a problem getting the value of textbox and transfer it to controller
here's my code
manifest.php(view)
<form method="POST" action="<?php echo base_url('PortClient/view_voyage/');?>">
<div class=" container">
<div class="row">
<?php foreach($voyage_info as $voyage) { ?>
<input type="hidden" name="voyage_id" value="<?=$voyage->voyage_id?>">
</form>
<button type="submit" class="btn btn-primary primary-bg btn-lg col-md-2 m-3 btn-cus">
<h3>Voyage - <?=$voyage->voyage_number?></h3>
<small>Schedule - <?=$voyage->expected_arrival?> </small>
</button>
<?php } ?>
I want to get voyage_id and transfer it to controller
PortClient.php (controller)
public function view_voyage() {
$this->Auth->authCheck();
$data = $this->template();
$voyage_id = $this->input->post('voyage_id');
$data['view_cargo'] = $this->PortManifestModel->view_voyage($voyage_id)->result();
// your code here
$this->load->view("port/client/sub_manifest/sub_manifest_1", $data);
}
The value of voyage_id textbox doesnt transfer
What should I do?
$voyage_infoonly ever have a single entry in the array, if not then check to see if you have multiple hidden inputs with the same name.var_dump($voyage_info)in the view ?