取电子邮件和密码为空

时间:2018-12-27 06:41:05

标签: php codeigniter

在填写表格后单击注册按钮时,显示错误消息,指出电子邮件地址和密码为空,前端脚本验证了电子邮件和密码,但服务器端脚本出了问题。请看一下。 Stackoverflow要求我添加更多详细信息,但我不知道还应该输入什么以使其更加详细。因此,在这里我将详细输入细节。 Codeignator

View.php

<?php echo form_open('user/register'); ?>

<input type="text" class="form-control" name="fname" placeholder="First Name" required>
<input type="text" class="form-control" name="lname" placeholder="Last Name" required>
<input type="email" class="form-control" name="email" placeholder="Email" required>
<input type="text" class="form-control" name="number" placeholder="Phone Number" required>
<input type="text" class="form-control" placeholder="Birth Date" class="textbox-n" onfocus="(this.type='date')"  name="birthday"> 


<select id="gender" name="gender" class="form-control" required>
                                        <option selected="selected">--Gender--</option>
                                        <option value="Male">Male</option>
                                        <option value="Female">Female</option>
                                        <option value="Others">Others</option>
                                  </select>
<input type="password" class="form-control" maxlength="20" placeholder="Password"   name="password" required>
<button type="submit">Register</button>
    php echo form_close(); ?><p>

用户控制器

function register()
{

    $data['error'] = NULL;
    if($this->input->post())
    {
        $config = array(
             array(
                'field' => 'fname',
                'label' => 'First Name',
                'rules' => 'trim|required',
            ),
             array(
                'field' => 'lname',
                'label' => 'Last Name',
                'rules' => 'trim|required',
            ),
            array(
                'field' => 'number',
                'label' => 'Phone Number',
                'rules' => 'trim|required|min_length[10]|max_length[10]|is_unique[users.number]',
            ),
            array(
                'field' => 'password',
                'label' => 'Password',
                'rules' => 'trim|required|min_length[5]|max_length[20]',
            ),

            array(
                'field' => 'gender',
                'label' => 'Gender',
                'rules' => 'trim|required',
            ),
             array(
                'field' => 'birthday',
                'label' => 'Birth Date',
                'rules' => 'trim|required',
            ),
            array(
                'field' => 'email',
                'label' => 'Email',
                'rules' => 'trim|required|is_unique[users.email]|valid_email',
            ),




        );
        $this->load->library('form_validation');
        $this->form_validation->set_rules($config);
        if($this->form_validation->run() == FALSE)
        {
            $data['error'] = validation_errors();
        }
        else 
        {
.
.
.
Further registration Process

0 个答案:

没有答案