简体   繁体   English

如何将值从php中的视图页面传递给控制器​​?

[英]How to pass values to controller from view page in php?

I want to upload several files to the system. 我想将几个文件上传到系统。 For that I used several checkboxes to select relevant upload and I want to pass that value from 为此,我使用了几个复选框来选择相关的上传,我想从中传递该值

form_open_multipart('controller function') 

to controller page. 到控制器页面。 When selecting upload type I set value to label in view page.Then using 选择上传类型时,我将值设置为视图页面中的标签。然后使用

form_open_multipart()

function I direct it to controller function. 功能我将其定向到控制器功能。 I want to get the value of label. 我想获得标签的价值。 how can I do this? 我怎样才能做到这一点?

I set value from js to view element (label) using 我使用以下方法从js设置值以查看元素(标签)

$('#set').text(send_id);

<?php 
echo form_open_multipart('uploadFile/doupload');   
?>

<table width="50%" border="0" align="right" cellpadding="0" cellspacing="0" bordercolor="#e65C00" style="border-radius: 5px;">

    <tr id="sliding" style="display:none;">
        <td>
            <label id="set" name="set"></label>
        </td>
        <td>

            <h4>Upload File</h4>
            <div  class="panel panel-warning" id="color" style="background: #ffffff; width:100%; height: auto;">
                Select File To Upload:<br />
                <input type="file" id="userfile" name="userfile" size="20" />

                <br /><br />

                <input type="submit" name="upload_file" value="Upload" class="btn btn-success">

            </div>
        </td>
    </tr>
</table> 
<?php echo form_close(); ?>

You can do any of the following 3 您可以执行以下任一操作3

  • Post the values directly from form. 直接从表单发布值。
  • You can keep the value in a hidden field and then post it. 您可以将值保留在隐藏字段中,然后发布。
  • You can pas the values as the parameter for the controller function. 您可以将这些值作为控制器功能的参数。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM