这是我的表单,它看起来是正确的,所以这应该不是问题,我还删除了enctype以确保它不是那样的。
<form action="<?php echo JRoute::_('index.php?option=com_woo&task=hello.create'); ?>" enctype="multipart/form-data" method="post">
<p>
Project Name :
<input style="width:30%;" name="name" id="name"/>
<input style="display:none;" id="user_id" name="user_id" value="<?php echo $user->id;?>"/>
<input style="display:none;" id="county" name="county"/>
<input style="display:none;" id="state" name="state" />
</p>
<button type="submit" class="btn-green" id="select_county">Create Project</button>
</form>ControllerHello内幕
public function create()
{
$jinput = JFactory::getApplication()->input;
$foo = $jinput->get('state', '', 'filter');
print_r($foo);
die;
}返回"NULL“
有什么想法吗?
发布于 2012-11-23 22:15:17
$input = new JInput;
$name = $input->get('name', '', 'post');
$country = $input->get('country', '', 'post');
// etc.然后,您可以将一系列JInput类方法用于特定目的:
// method integer getInt() getInt($name, $default = null) Get a signed integer.
// method integer getUint() getUint($name, $default = null) Get an unsigned integer.
// method float getFloat() getFloat($name, $default = null) Get a floating-point number.
// method boolean getBool() getBool($name, $default = null) Get a boolean.
// method string getWord() getWord($name, $default = null)
// method string getAlnum() getAlnum($name, $default = null)
// method string getCmd() getCmd($name, $default = null)
// method string getBase64() getBase64($name, $default = null)
// method string getString() getString($name, $default = null)
// method string getHtml() getHtml($name, $default = null)
// method string getPath() getPath($name, $default = null)
// method string getUsername() getUsername($name, $default = null)发布于 2013-03-31 17:14:20
你可以试试这个-
$input = JFactory::getApplication()->input;
$post_array = $input->getArray($_POST);发布于 2014-09-29 18:00:56
我认为使用JInput获得完整$_POST的最佳选择是
JFactory::getApplication()->input->post->getArray();如果您想从请求中获取特定的数组(例如,名为'jform‘),那么可以使用
JFactory::getApplication()->input->get('jform', array(), 'ARRAY');https://stackoverflow.com/questions/13500803
复制相似问题