表单未在 PHP 中的 <li> 下发布值
Form Not Posting Values Under <li> in PHP
我有一个 <li>
下的表格,它不是 posting 值。表单 method="post"
但如果我将其更改为 method="get"
它可以将文件和 post 值传递给控制器。我正在使用 codeigniter
它对我来说在本地主机上离线工作正常但在线工作不正常
HTML 代码
<li>
<form method="post" style=" display: inline;" action="http://carrentalschandigarh.com/blog/Page/2">
<input type="submit" class="pag" value="2" name="submit">
<input type="hidden" value="10" name="max">
<input type="hidden" name="min" value="5">
</form>
</li>
控制器代码
//Under Home Controller
public function Blog() {
echo $this->input->post('max');
echo $this->input->post('min');
}
.Htaccess 代码 它绑定 url 到 home/Blog
$route['blog/Page/(:any)'] = "Home/Blog";
我在网上看到了 Url 你提供的 - carrentalschandigarh。com/blog 我注意到每当我打开这个 url 时自动将 www 添加到 url 意味着
当我打开 carrentalschandigarh.com/blog 时,它变成了 www.carrentalschandigarh.com/blog。您可能已经在 .htaccess 文件中设置了它
但是,如果您看到您的表单操作没有 www 域,我认为表单操作应该是“http://www.carrentalschandigarh.com/blog/Page/2”
替换 html 代码中的下行
<form method="post" style="display: inline;" action="http://carrentalschandigarh.com/blog/Page/2">
下面有正确的代码行
<form method="post" style="display: inline;" action="http://www.carrentalschandigarh.com/blog/Page/2">
而且我确认它肯定会工作,因为我在您提供的 link 上测试过它(通过浏览器开发人员工具 - 检查元素)
我有一个 <li>
下的表格,它不是 posting 值。表单 method="post"
但如果我将其更改为 method="get"
它可以将文件和 post 值传递给控制器。我正在使用 codeigniter
它对我来说在本地主机上离线工作正常但在线工作不正常
HTML 代码
<li>
<form method="post" style=" display: inline;" action="http://carrentalschandigarh.com/blog/Page/2">
<input type="submit" class="pag" value="2" name="submit">
<input type="hidden" value="10" name="max">
<input type="hidden" name="min" value="5">
</form>
</li>
控制器代码
//Under Home Controller
public function Blog() {
echo $this->input->post('max');
echo $this->input->post('min');
}
.Htaccess 代码 它绑定 url 到 home/Blog
$route['blog/Page/(:any)'] = "Home/Blog";
我在网上看到了 Url 你提供的 - carrentalschandigarh。com/blog 我注意到每当我打开这个 url 时自动将 www 添加到 url 意味着
当我打开 carrentalschandigarh.com/blog 时,它变成了 www.carrentalschandigarh.com/blog。您可能已经在 .htaccess 文件中设置了它
但是,如果您看到您的表单操作没有 www 域,我认为表单操作应该是“http://www.carrentalschandigarh.com/blog/Page/2”
替换 html 代码中的下行
<form method="post" style="display: inline;" action="http://carrentalschandigarh.com/blog/Page/2">
下面有正确的代码行
<form method="post" style="display: inline;" action="http://www.carrentalschandigarh.com/blog/Page/2">
而且我确认它肯定会工作,因为我在您提供的 link 上测试过它(通过浏览器开发人员工具 - 检查元素)