Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.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 我正在使用post方法提交表单,但无法从输入字段中获取值。我怎样才能得到这个值_Php_Forms_Input_Label_Codeigniter 3 - Fatal编程技术网

Php 我正在使用post方法提交表单,但无法从输入字段中获取值。我怎样才能得到这个值

Php 我正在使用post方法提交表单,但无法从输入字段中获取值。我怎样才能得到这个值,php,forms,input,label,codeigniter-3,Php,Forms,Input,Label,Codeigniter 3,在您的类miner的miner\u登录中,您可以获得如下所示的值,这些值可能会对您有所帮助。 始终尝试通过创建变量来分配它,以获得更好的代码结构 <form class="form" method="post" action="<?php echo site_url("miner/miner_logins"); ?>"> <label>Email :</label> <input type="text" name="demail" id="e

在您的类
miner
miner\u登录中,您可以获得如下所示的值,这些值可能会对您有所帮助。
始终尝试通过创建变量来分配它,以获得更好的代码结构

<form class="form" method="post" action="<?php echo site_url("miner/miner_logins"); ?>">
<label>Email :</label>
<input type="text" name="demail" id="email">
<label>Password :</label>
<input type="password" name="password" id="password"> <br>enter code here
<input type="submit" name="login" id="login" value="LOG IN" class="btnlogin">
<p align="center"><a href="#">Forgot Password? Reset enter code heret via the Website</a></p>
</form>
试试这个

if($this->input->post())   // Before getting the values, check with this
{
    $demail   = $this->input->post('demail', TRUE);
    $password = $this->input->post('password', TRUE);

    echo $demail; // You will get the value of demail.
    echo $password; // You will get the value of password.
}

您可以更新表单以保留输入值,详细信息请参见
set\u value
part


我还没有测试代码,但希望这能帮助您了解如何在CI中处理表单提交

在控制器方法
miner\u logins
中,尝试“echo$this->input->post('demail',TRUE)”;死亡`我希望他们有一个manual@AlivetoDie我刚刚发布了答案,你们可以看到我的评论和答案之间的区别。
$var_1 = $this->input->post('demail', TRUE);
$var_2 = $this->input->post('password', TRUE);
<form class="form" method="post" action="<?php echo site_url("miner/miner_logins"); ?>">
<label>Email :</label>
<input type="text" name="demail" value="<?php echo set_value('demail'); ?> id="email">
<label>Password :</label>
<input type="password" name="password" id="password"> <br>enter code here
<input type="submit" name="login" id="login" value="LOG IN" class="btnlogin">
<p align="center"><a href="#">Forgot Password? Reset enter code heret via the Website</a></p>
</form>
public function miner_logins(){
  $this->load->library('form_validation');
  $this->form_validation->set_rules('password', 'Password', 'required');
  $this->form_validation->set_rules('demail', 'Email', 'required|valid_email');

  if ($this->form_validation->run() == FALSE)
  {
     $this->load->view('miner_logins_view');
  }else{
    // set required session here and do redirection to user page.
  }
}