我正在使用codeigniter 3.1。
从不同功能提交数据后如何返回或获取已发布的电子邮件?
的HTML
<form action="settings/valid" class="form-horizontal" enctype="multipart/form-data" method="post" accept-charset="utf-8">
<input type="email" name="email" value="<?php echo $email ?>" />
<input type="submit"/>
</form>
的PHP
public function index() {
// how to get post email ?
$email = $this->input->post("email"));
$this->template->loadContent("settings/index.php", array(
"email" => $email
)
);
}
public function valid() {
$email = $this->input->post("email"));
$this->user->add($this->user->ID, array(
"email" => $email
));
redirect(site_url("index.php"));
}
这可能会更好地回答您的问题。
public function index() {
// how to get post email ?
$email = $this->session->flashdata("email");
$this->template->loadContent("settings/index.php", array(
"email" => $email
)
);
}
public function valid() {
$email = $this->input->post("email"));
$this->user->add($this->user->ID, array(
"email" => $email
));
$this->session->set_flashdata("email",$email);
redirect(site_url("index.php"));
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句