codeigniter - How to make array of textbox fields in PHP? -
i'm using codeigniter framework.
i'm using form_input
function make 2d array of textboxes , pulldowns.
the function produces html this:
<input type="box" name= "variable">
i need create 30 rows of 5 textboxes (time, event, supplies, sucess{yes/no}, comment).
my plan somehow able uniquely identify them @ later stage when $post
them page wont confused textbox time1
or textbox time2
.
i'm trying make array of texboxes in php when use for
loop (isset
) can stop when row not completed user.
this code here im not sure if spot on
for ($i =0; $i< 30; $i++) { //time part of event field echo form_input ($events['time',$i]), //the event form_input ($events['event',$i]), //supplies used form_input ($events['supplies',$i]), //successful? form_dropdown ($events['success',$i] $success), //comment if necessary form_input ($events['time',$i]); echo '<br/>'; }
i don't understand either regarding $_post object; ci docs:
codeigniter comes 3 helper functions let fetch post, cookie or server items. main advantage of using provided functions rather fetching item directly ($_post['something']) functions check see if item set , return false (boolean) if not. lets conveniently use data without having test whether item exists first. in other words, might this:
if ( ! isset($_post['something'])) { $something = false; } else { $something = $_post['something']; }
with codeigniter's built in functions can this:
$something = $this->input->post('something');
Comments
Post a Comment