dongrenshi0889 2015-06-03 06:45
浏览 56

如果不存在,如果循环获取数据(如果不存在则在表中),则在表和javascript中插入值以获取写入配置文件ID的数据

I need a if loop in view file and a javascript when profile id is entered it should show all the related elements in the form and i'm doing this in codeignitor and this is the part of view file

                        <tr>
                            <td width='50%'>
                                <table width="50%"><tr> 
                                    <td width="50%"><strong>Profile ID </strong></td>
                                    <td width="50%"><input type="text" id="profile_id" name="profile_id" value="<?php echo $reg_personal_details->profile_id;?>"placeholder="Employee ID "/><?php echo form_error('profile_id');?><br></td>
                                </tr>

                                <tr> 
                                    <td><strong>Employee Name </strong></td>
                                    <td><input type="text" id="profile_fname" name="profile_fname" value="<?php echo $reg_personal_details->profile_fname;?>"placeholder="Employee Name"/><?php echo form_error('profile_fname'); ?><br></td>
                                </tr>
                                <tr> 
                                    <td><strong>Employee Type </strong></td>
                                    <td>
                                         <input type="text" id="profile_type" name="profile_type" value="<?php echo $reg_personal_details->profile_type;?>"placeholder="Employee Type"/><?php echo form_error('profile_type');?><br>
                                    </td>
                                </tr>
                                <tr> 

here is my table: profile (profile_id, profile_fname, profile_lname, profile_email, profile_mobile, profile_type, profile_gender, profile_dob, profile_marital_status, profile_religion, profile_blood_group, profile_nationality, profile_iris, profile_biometric, profile_department, profile_designation, profile_project_designation, profile_image, address_1, address_2)

profile_id is a foreign key and its primary key is in other table as emp_acc_id

model for the above is :

public function reg_personal_details()

{ $reg_personal_details = array(

    // i also need a condition here to read the entered profile_id all that below data must be store in that id only//

    'profile_type' => $this->input->post('profile_type'),

    'profile_gender' => $this->input->post('profile_gender'),


    'profile_dob' => $this->input->post('profile_dob'),

    'profile_marital_status' => $this->input->post('profile_marital_status'),

    'profile_religion' => $this->input->post('profile_religion'),

    'profile_blood_group' => $this->input->post('profile_blood_group'),

    'profile_nationality' => $this->input->post('profile_nationality'),

    'profile_iris' => $this->input->post('profile_iris'),

    'profile_biometric' => $this->input->post('profile_biometric'),

    'profile_department' => $this->input->post('profile_department'),

    'profile_designation' => $this->input->post('profile_designation'),

'profile_project_designation' => $this->input->post('profile_project_designation'), );

    $this->db->update('profile',$reg_personal_details);
  • 写回答

2条回答 默认 最新

  • dongzeao5047 2015-06-03 11:57
    关注

    You Should write a java Script which would check if a particular element exists or not i.e if its value is not null then generate a new row tags dynamically and set its value what we get in response of the query. For generating a tag dynamically you can refer the following page:-

    http://www.dustindiaz.com/add-and-remove-html-elements-dynamically-with-javascript/

    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么