【问题标题】:I can't send a URL in a form我无法在表单中发送 URL
【发布时间】:2015-04-16 03:49:17
【问题描述】:
<form action="http://xxx.xxx/Komore/index.php/komore/dodaj_komoro" method="post" accept-charset="utf-8">
    <input id="d1" name="datum" value="<?php echo set_value('datum'); ?>" class="TextBox4" />
    <input name="dimenzije" value="<?php echo set_value('dimenzije'); ?>" class="TextBox4"  />
    <input name="meritve1" value="<?php echo set_value('meritve1'); ?>" class="TextBox5" />
    <input name="meritve2" value="<?php echo set_value('meritve2'); ?>" class="TextBox6" id="m1"/>
    <input name="meritve3" value="<?php echo set_value('meritve3'); ?>" class="TextBox7" id="m2"/>
    <input name="meritve4" value="<?php echo set_value('meritve4'); ?>" class="TextBox8" id="m3" />
    <input name="doba" class="TextBox9" value="<?php echo set_value('doba');?>" />
    <textarea name="opombe" value="<?php echo set_value('opombe'); ?>" class="textarea1" ></textarea>
    <input type="submit" value="Dodaj komoro"  Text="Dodaj komoro"/>
</form>

我有一个表单,我通过它发送数据,在一个字段中,用户必须输入一个 URL 地址。当 URL 实际上是表单时,我收到一个 301 响应,它将我重定向到不存在的 xxx.xxx/Komore/komore/dodaj_komoro。奇怪的是,这不会发生在 localhost 上,并且当值不是 URL 地址时也不会发生。有什么想法吗?

php控制器dodaj_komoro中的代码(如果里面有URL,请求甚至不会到达这个代码):

public function dodaj_komoro(){
        $this->load->model('Komore_model');
        $this->load->helper('form');
        $this->load->library('form_validation');
        $this->form_validation->set_rules('st_komore', 'Številka komore', "required|xss_clean");
        $this->form_validation->set_rules('premer', 'Notranji premer', "required|xss_clean");
        $this->form_validation->set_rules('proizvajalec', 'Proizvajalec', "required|xss_clean");
        $this->form_validation->set_rules('datum', 'Datum prevzema', "required|xss_clean");
        $this->form_validation->set_rules('dimenzije', 'Dimenzije komore', "required|xss_clean");
        $this->form_validation->set_rules('meritve1','Meritve',"required|xss_clean");
        $this->form_validation->set_rules('meritve2','Meritve',"required|xss_clean");
        $this->form_validation->set_rules('meritve3','Meritve',"required|xss_clean");
        $this->form_validation->set_rules('meritve4','Meritve',"required|xss_clean");
        $this->form_validation->set_rules('opombe','Opombe',"");
        $this->form_validation->set_rules('doba','Življenska doba',"required|xss_clean");

        $this->form_validation->set_message('required', '<div class="error">Polje %s je obvezno.</div>');
        $this->form_validation->set_message('xss_clean', '<div class="error">Polje %s vsebuje neveljavne znake.</div>');
        if($this->form_validation->run() == FALSE)
        {
            $komore=$this->Komore_model->get_komore_stats_by_type($_POST["id_tip_komore"]);
            $tip_komore=$this->Komore_model->get_komora_oznaka($_POST["id_tip_komore"]);
            $this->load->view("komore",array("komore"=>$komore,"tip_komore"=>$tip_komore,"id_tip_komore"=>$_POST["id_tip_komore"]));
        }else{
            $meritve=$_POST["meritve1"].";".$_POST["meritve2"].";".$_POST["meritve3"].";".$_POST["meritve4"];
            $this->Komore_model->add_komora($_POST["id_tip_komore"],$_POST["premer"],$_POST["proizvajalec"],$_POST["datum"],$_POST["dimenzije"],$meritve,$_POST["opombe"],$_POST["st_komore"],$_POST["doba"]);
            redirect("komore/tip_komore/".$_POST["id_tip_komore"]);
        }
    }

【问题讨论】:

  • 哪个字段是URL地址?
  • 您能否将.htaccess 文件内容添加到您的问题正文中?顺便说一下,比较你的application/config/routes.phplocalhostexmple.com
  • 您不知道您的问题是什么?您已经询问了您的应用程序在 SOMEHOST 上的奇怪行为(例如:xxx.xxx、example.com),并且您说您的代码在您的本地主机上运行良好。所以我问你我是否可以看到/访问你的(xxx.xxx,example.com)一些主机。那你的域名是什么??你有我可以访问并查看你的表格的链接吗?
  • 我可以使用什么登录密码?
  • 好的,我以 tes/test 身份登录,您的表单页面在哪里?

标签: php forms codeigniter url http-status-code-301


【解决方案1】:

检查您的 htaccess.txt 文件。

我猜你有导致问题的重写模式规则。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-02-09
    • 2015-11-20
    • 2019-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-18
    • 2021-06-28
    相关资源
    最近更新 更多