post more value in href tag - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: post more value in href tag (/showthread.php?tid=71129) |
post more value in href tag - kvanaraj - 07-10-2018 I want to pass my dropdown value to the controller . when i click this add button only one value can pass. <a href="'.site_url("").'User/addsubjects/'.$row['subcode'].'" class="btn btn-info">Add</a> </td>'; can i able to pass two values (dropdown ,subcode) values to the controller RE: post more value in href tag - Pertti - 07-10-2018 Drop-down is browser side, so while technically you can add more attributes to URL, and your Controller can pick these up, you would either had to build a JS script that appends to href value, or you would have to change A tag to a Form submission: Code: <from action="<?= site_url("").'User/addsubjects/'.$row['subcode'] ?>" method="POST"> PHP Code: // Controller Also, a quick note, to make code more readable, you should add all URL attributes inside site_url function like this PHP Code: site_url('User/addsubjects/'.$row['subcode']); Both ways technically work, but this is tidier and intended way. |