简体   繁体   English

Codeigniter和表格

[英]Codeigniter and Form

I have a problem with Codeigniter and my hosting provider... 我对Codeigniter和托管服务提供商有疑问...

I have created a form with function form_open('welcome/index') and it produces this html code <form action="http://gggg.com/index2.php/welcome/index" method="post"> but this doesn't work, infact when I submit the form I will return in the same page without effects. 我用函数form_open('welcome / index')创建了一个表单,它生成了这个html代码<form action="http://gggg.com/index2.php/welcome/index" method="post">不起作用,事实上,当我提交表单时,我将返回同一页面而没有效果。

I have to say that there are no errors in the code, because it works in localhost and works also if I write form_open('http://gggg.com/index2.php/welcome/index') . 我不得不说代码中没有错误,因为它在localhost中有效,并且在我编写form_open('http://gggg.com/index2.php/welcome/index')

So, in summary if I write: form_open('welcome/index') , it doesn't work else if I write: form_open('http://gggg.com/index2.php/welcome/index') , it works 因此,总而言之,如果我编写: form_open('welcome/index') ,那么如果我编写: form_open('http://gggg.com/index2.php/welcome/index') ,它将无法正常工作

It's very strange, can anybody help me? 很奇怪,有人可以帮助我吗?

It would help to know what URL it is actually sending the form data to. 了解它实际发送表单数据的URL有助于。

You need to look through your config file. 您需要查看配置文件。 Make sure the correct values are set for: 确保为以下项设置了正确的值:

$config['base_url'] = "http://gggg.com/";
$config['index_page'] = "index2.php";

Also make sure you htaccess files are correct, if you are running on Apache. 如果您在Apache上运行,还要确保htaccess文件是正确的。

If you are not modified your htaccess to allow URLs like http://ggg.com/controller/function/param1 , you should always add 'index2.php' and the beginning of all of your URLs. 如果您未修改htaccess以允许 http://ggg.com/controller/function/param1网址 ,则应始终添加“index2.php”和所有网址的开头。

Try to modify using form_open('index2.php/welcome/index') . 尝试使用form_open('index2.php/welcome/index')进行修改。

Anyways, check your config.php file just how Michael told you. 无论如何,请检查Michael告诉您的config.php文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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