我只是想知道你是否可以帮助我获取表格行的值,然后将其放入模型中。
以下是我的观点:
<div class="table_design">
<style>
#tbl_ulist1 tr:hover td{
background-color: yellow;
}
#txt_fn1{
border: none;
background-color: transparent;
}
</style>
<form action="userslist" method="POST">
<input type="submit" id="new_user" name="new_user" value="Add New User"/>
<table id="tbl_ulist1">
<tr>
<!-- <th>Edit/Delete</th>-->
<th>First Name</th>
<th>Last Name</th>
<th>Middle Name</th>
<th>Birth Date</th>
<th>Contact Details</th>
<th>Email Add</th>
<th>User Type</th>
<th>Status</th>
</tr>
<?php foreach ($userslist as $row) { ?>
<tr id="tr1" data-toggle="modal" data-target="#myModal">
<!--<td><a href="<?php echo site_url('inventorysys_controller/edit_user'); ?>/<?php echo $row->ID ?>">Edit</a></td>-->
<td><input type="text" id="txt_fn1" value="<?php echo $row->FirstName ?>" readonly/></td>
<td><?php echo $row->LastName ?></td>
<td><?php echo $row->MiddleName ?></td>
<td><?php echo $row->Birthdate ?></td>
<td><?php echo $row->ContactDetails ?></td>
<td><?php echo $row->EmailAdd ?></td>
<td><?php echo $row->UserType ?></td>
<td><?php echo $row->Status ?></td>
</tr>
<?php } ?>
</table>
</form>
</div>
这是我的div模式:
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" style="width: 80%; height: 60%; margin-top: 200px;">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 style="color: black;"></h4>
<div class="modal-body">
<iframe style="width: 100%; height: 60%; border: none;" frameborder="0" src="<?php echo site_url('inventorysys_controller/edit_user'); ?>"></iframe>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</div>
</div>
以下是我的模态中的iframe视图:
<div id="content">
<link rel="stylesheet" href="<?php echo base_url('assets/css/bootstrap.min.css'); ?>">
<style>
#tbl_edituser{
color: black;
}
</style>
<form action="edit_user" method="POST" name="frm_edituser" id="frm_edituser">
<fieldset>
<legend>Edit User</legend>
<table id="tbl_edituser">
<tr>
<td>First Name:</td>
<td><input type="text" name="txt_userfirst" id="txt_userfirst" value="<?php //echo $system_users->FirstName ?>"/></td>
<td>Last Name:</td>
<td><input type="text" name="txt_userlast" id="txt_userlast" value="<?php //echo $system_users->LastName ?>"/></td>
<td>Middle Name:</td>
<td><input type="text" name="txt_usermiddle" id="txt_usermiddle" value="<?php //echo $system_users->MiddleName ?>"/></td>
<td><input type="hidden" name="txt_edituserID" id="txt_edituserID" value="<?php //echo $system_users->ID ?>"/></td>
</tr>
<tr>
<td>Birth Date:</td>
<td><input type="date" name="dt_user" id="dt_user" style="width: 100%; height: 80%" value="<?php //echo //$system_users->Birthdate ?>"/></td>
<td>Email Address:</td>
<td><input type="text" name="txt_emailaddress" id="txt_emailaddress" value="<?php// echo $system_users->EmailAdd ?>"/></td>
<td>Contact Details:</td>
<td><input type="text" name="txt_contactdetails" id="txt_contactdetails" value="<?php// echo $system_users->ContactDetails ?>"/></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="txt_editusername" id="txt_editusername" value="<?php// echo $system_users->Username ?>"/></td>
<td>Password:</td>
<td><input type="password" name="txt_editpassword" id="txt_editpassword" value="<?php //echo $system_users->Password ?>"/></td>
<td>User Type:</td>
<td>
<select id="cbo_editusertype" name="cbo_editusertype" style="width: 100%">
<option><?php// echo $system_users->UserType ?></option>
<option>Administrator</option>
<option>User</option>
</select>
</td>
</tr>
<tr>
<td>Status:</td>
<td>
<select id="cbo_edituserstatus" name="cbo_edituserstatus" style="width: 100%">
<option><?php //echo $system_users->Status ?></option>
<option>Active</option>
<option>Inactive</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><input type="button" id="btn_edituserdetails" name="btn_edituserdetails" onclick="validate_editsystemusers();" value="Update"/> <input type="button" id="btn_deleteuserdetails" name="btn_deleteuserdetails" onclick="validate_deletesystemuser();" value="Delete"/></td>
</tr>
</table>
<input type="hidden" name="ninja14" id="ninja14" value=""/>
</fieldset>
</form>
这是我模态的控制器:
public function edit_user(){
// $data_users['system_users'] = $this->inventory_model->select_systemusers();
// $this->load->view('homeview');
$this->load->view('edituser_view');
// $this->load->view('footer_view');
}
请帮我这个!我花了好几个小时思考这个。