這裏的形式:笨:爲什麼笨思維形式是一個GET請求而不是POST請求
<?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']? – sikander 2012-07-19 03:23:36
$ this-> input-> server('REQUEST_METHOD')返回什麼? – 2012-07-19 03:25:43
form_open默認使用POST方法,因此除非您在其他地方執行服務器請求方法,否則它無法使用。如果它實際上是GET,那麼一旦你在處理表單的文件上使用print_r($ _ POST)就不會得到任何東西。 – 2012-07-19 03:26:31