简体   繁体   中英

Form Not Posting Values Under <li> in PHP

I am having a form under <li> it is not posting values. Form method="post" but if I change it to method="get" it works file and post values to controller. I am using codeigniter

It is working Fine For me Offline on localhost but not working fine online

HTML CODE

<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>

Controller Code

//Under Home Controller
public function Blog() {
echo $this->input->post('max');
echo $this->input->post('min');
}    

.Htaccess Code It Binds url to home/Blog

$route['blog/Page/(:any)'] = "Home/Blog";

I have seen theonline Url you provided - carrentalschandigarh.com/blog and I have noticed whenever i open this url automatically www is added to url means

when i open carrentalschandigarh.com/blog it becomes www.carrentalschandigarh.com/blog . You may have set that in .htaccess file

But if you see your Form action it does not have www with domain I think form action should be " http://www.carrentalschandigarh.com/blog/Page/2 "

Replace below line in html code

<form method="post" style="display: inline;" action="http://carrentalschandigarh.com/blog/Page/2">

With Correct code line below

<form method="post" style="display: inline;" action="http://www.carrentalschandigarh.com/blog/Page/2">

And I am confirmed it will definately work as I tested it on same link you provided (through browser developer tool - inspect element)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM