【发布时间】:2012-07-18 04:49:22
【问题描述】:
这是表格:
<?php echo form_open('locker_settingstwo/processform', array('class' => 'form-horizontal')); ?>
<div class = "lockersettingstwodiv">
<h2><?php echo $this->session->userdata('labelname'); ?></h2>
<p> Control who can view/ReGemz the collection in this locker </p>
<input type = "text" name = "testing" value = "" />
<input type="radio" name="permission" value="1" /> Public - Others can view/edit this locker<br/>
<input type="radio" name="permission" value="2" /> Me Only - Only you can view/edit this locker<br/>
<input type="radio" name="permission" value="custom" /> Custom - Locked to everyone, meaning only friends I choose can view/edit this locker<br/>
</div>
<input type="submit" name = "Next" value="Next" class="btn btn-large btn-primary" style="margin-left: 0px; margin-top: 14px" />
<input type="submit" name = "Cancel" value="Cancel" class="btn btn-large btn-primary" style="margin-left: 0px; margin-top: 14px" />
<?php echo form_close(); ?>
现在当我打印 $_SERVER['REQUEST_METHOD'] 时,它说的是 GET,而不是 POST...这是为什么呢?
这是表单发送到的控制器方法:
function processform()
{
echo $_SERVER['REQUEST_METHOD'];
}
【问题讨论】:
-
你什么时候打印 $_SERVER['REQUEST_METHOD'] ?
-
$this->input->server('REQUEST_METHOD') 返回什么?
-
form_open 默认使用 POST 方法,因此除非您在其他地方执行服务器请求方法,否则它不能使用。如果它实际上是 GET,那么一旦你在处理表单的文件上 print_r($_POST),你将不会得到任何东西。
-
我总是接受,我不知道它不是更高..
-
@dave,接受你著名问题的答案,你可能会得到更多的人。
标签: php forms codeigniter post