Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Forms 未设置POST数据?共点火器溶液_Forms_Codeigniter_Post - Fatal编程技术网

Forms 未设置POST数据?共点火器溶液

Forms 未设置POST数据?共点火器溶液,forms,codeigniter,post,Forms,Codeigniter,Post,我想我有一个简单的错误,但我看不到它! 在我看来,我使用以下javascript创建表单: $.ajax({ url:"<?php echo site_url('mycontroller/methodX/'.$ip.'/'.$hardwaremodel);?>", type:'POST', dataType:'json', success: function(returnDataFromController) { var htmlstrin

我想我有一个简单的错误,但我看不到它! 在我看来,我使用以下javascript创建表单:

  $.ajax({
    url:"<?php echo site_url('mycontroller/methodX/'.$ip.'/'.$hardwaremodel);?>",
    type:'POST',
    dataType:'json',
    success: function(returnDataFromController) {
    var htmlstring;
    var submitFormHTML;
    htmlstring = "<br><br><B>To reassign the port to a new vlan, click on a VlanId below and then click on the OK button</B><br><table class='table table-bordered table-striped'>";
    htmlstring = htmlstring + "<th>VlanId</th><th>Name</th>";
    for(i = 0; i < returnDataFromController.length; i++) {

    }
    submitFormHTML = "<form method='post' accept-charset='utf-8' action='/myapp/index.php/controllerABC/methodABC/"+ $('#ip').val() +"/" + $('#hardwaremodel').val() +"/" + $('#port').val() + "'><input type='text' id='newVlanID' style='width:5em;height:1.5em'/>&nbsp;&nbsp;<button type='submit' class='btn' id='saveVlan' style='width:10em;height:2em'>Reassign Vlan</button></form>";
    //alert(submitFormHTML);
    $('#clientajaxcontainer').html(htmlstring);
    $('#newvlanform').html(submitFormHTML);
它总是打印“假”。我还尝试使用:

print_r($this->input->post());

但我似乎无法将视图中的数据输入控制器。 你能看出我错在哪里吗?谢谢你的帮助

编辑:

呈现页面时,将为表单创建以下HTML:

<form method="post" action="/myapp/index.php/switches/changeportvlan/11.11.11.11 /">
<input type='text' id='newVlanID' style='width:5em;height:1.5em'/>&nbsp;&nbsp;
<button type="submit" class='btn' id='saveVlan' style='width:10em;height:2em'>Reassign Vlan</button>
</form>"

重新分配Vlan
"
您需要

if ($this->input->post(Null, False)) {
   echo "I am here";
   $form = $this->input->post(Null, True); ## True for XSS-cleaning, which you probably want.
   exit();
}
else {
   echo "False";
}
您必须提供
$this->input->post()
参数。此外,切勿在CodeIgniter中使用
$\u post

祝你好运

你需要

if ($this->input->post(Null, False)) {
   echo "I am here";
   $form = $this->input->post(Null, True); ## True for XSS-cleaning, which you probably want.
   exit();
}
else {
   echo "False";
}
您必须提供
$this->input->post()
参数。此外,切勿在CodeIgniter中使用
$\u post


祝你好运。

问题是文本框缺少“名称”属性。“id”不够!

问题是文本框缺少“名称”属性。“id”不够!

感谢您的回复。但这也不起作用。仍然只打印“False”“。我最初只使用了输入,但在这个网站上发现了另一个帖子,有人建议尝试使用$\u帖子进行故障排除…只要在任何类型的
if
语句之前这样做:
print\r(input->post(NULL,False);
你就会看到到底发生了什么。另外,请使用
form\u open()
打开表单,因为您不应该为表单使用绝对路径。使用
嘿…re:the form_open(),在我看来,我实际上是通过javascript构建此表单。但是为了本文的目的(简化)我刚刚发布了生成的HTML。事实上,也许你会对我之前的帖子发表评论,因为它与路径有关。谢谢你的回复。但这也不起作用。仍然只打印出一个“False”。我最初只使用了输入,但在这个网站上发现了另一篇帖子,有人建议尝试使用$_post进行故障排除…只要在任何类型的
if
语句之前这样做:
print\r($this->input->post(NULL,False);
你就会看到到底发生了什么。另外,请使用
form\u open()
打开表单,因为您不应该为表单使用绝对路径。使用
嘿…re:the form_open(),在我看来,我实际上是通过javascript构建此表单。但是为了本文的目的(简化)我刚刚发布了结果HTML。事实上,也许你会对我之前的文章发表评论,因为它与路径有关。
if ($this->input->post(Null, False)) {
   echo "I am here";
   $form = $this->input->post(Null, True); ## True for XSS-cleaning, which you probably want.
   exit();
}
else {
   echo "False";
}