Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting $_POST with Joomla 2.5

Here is my form, it looks correct, so this shoulnd't be an issue , I also removed the enctype to make sure it wasn't that.

    <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>

Inside ControllerHello

    public function create()
    {
       $jinput = JFactory::getApplication()->input;
       $foo = $jinput->get('state', '', 'filter');
       print_r($foo);
       die;
    }

Returns "NULL"

Any ideas?

like image 464
LukePOLO Avatar asked Nov 21 '12 19:11

LukePOLO


1 Answers

You can try this -

$input = JFactory::getApplication()->input;
$post_array = $input->getArray($_POST);
like image 178
Irfan Avatar answered Oct 18 '22 23:10

Irfan