Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php MVC:从视图到控制器的输入中检索值_Php_Codeigniter_Mysqli - Fatal编程技术网

Php MVC:从视图到控制器的输入中检索值

Php MVC:从视图到控制器的输入中检索值,php,codeigniter,mysqli,Php,Codeigniter,Mysqli,我知道这似乎是一个反复出现的问题。但是我已经创建了这个表单,我想得到email字段的值,以便生成二维码 这就是我们的观点 <div class="row"> <div class="col-md-6 col-md-offset-3"> <div class="panel panel-default"> <div class="panel-heading"> <h4

我知道这似乎是一个反复出现的问题。但是我已经创建了这个表单,我想得到email字段的值,以便生成二维码 这就是我们的观点

<div class="row">
    <div class="col-md-6 col-md-offset-3">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4>Registration form</h4>
            </div>
            <div class="panel-body">
                <?php $attributes = array("name" => "registrationform");
                echo form_open("user/register", $attributes);?>
                <div class="form-group">
                    <label for="name">First Name</label>
                    <input class="form-control" id="fname" name="fname" placeholder="Your First Name" type="text" value="<?php echo set_value('fname'); ?>" />
                    <span class="text-danger"><?php echo form_error('fname'); ?></span>
                </div>

                <div class="form-group">
                    <label for="name">Last Name</label>
                    <input class="form-control" name="lname" placeholder="Last Name" type="text" value="<?php echo set_value('lname'); ?>" />
                    <span class="text-danger"><?php echo form_error('lname'); ?></span>
                </div>

                <div class="form-group">
                    <label for="email">Email ID</label>
                    <input class="form-control" id="email" name="email" placeholder="Email-ID" type="text" value="<?php echo set_value('email'); ?>" />
                    <span class="text-danger"><?php echo form_error('email'); ?></span>
                </div>

                <div class="form-group">
                    <label for="subject">Password</label>
                    <input class="form-control" name="password" placeholder="Password" type="password" />
                    <span class="text-danger"><?php echo form_error('password'); ?></span>
                </div>

                <div class="form-group">
                    <label for="subject">Confirm Password</label>
                    <input class="form-control" name="cpassword" placeholder="Confirm Password" type="password" />
                    <span class="text-danger"><?php echo form_error('cpassword'); ?></span>
                </div>

                <div class="form-group">
                    <button name="submit" type="submit" class="btn btn-default">Signup</button>
                    <button name="cancel" type="reset" class="btn btn-default">Cancel</button>
                </div>
                <?php echo form_close(); ?>
                <?php echo $this->session->flashdata('msg'); ?>
          </div>
          </div>
         </div>
//此函数将重定向到仅使用电子邮件调用成功的视图
但我仍然无法回复电子邮件。请提供任何帮助。

更改您的表单操作

  <?php $attributes = array("name" => "registrationform");
            echo form_open("user/register", $attributes);?>

致:


您正在将用户重定向到另一个页面,该页面不会保持
POST
数据的完整性。我建议只加载视图,
$this->load->view('successful',$data),而不是重定向,从而将所有内容保留在一个函数中


注意:我不确定
用户模型->插入器()
函数内部发生了什么,但请确保在将原始数据插入任何数据库之前先将其转义。

设置值()
仅适用于表单库,只是作为
表单错误()的旁注。
,您可以设置表单错误分隔符一次,而不必为已从控制器加载的每个错误@Saty:form Library单独设置。下一步我该怎么做?注册是插入成功的功能插入是一个只使用电子邮件重定向到另一个视图的功能。查一下编辑谢谢詹姆斯。这确实奏效了。有没有关于如何转换为二维码的建议?通过快速的谷歌搜索,你可以选择1。使用CodeIgniter的QR码库,如或2。使用第三方API,如Thank James。第二个成功了。先生,我该怎么报答你呢?非常感谢:)如果这解决了问题,你应该接受答案:)
  <?php $attributes = array("name" => "registrationform");
            echo form_open("user/register", $attributes);?>
 <?php $attributes = array("name" => "registrationform");
            echo form_open("user/successInsert", $attributes);?>