[eluser]selftaught[/eluser]
When I select multiple choices and hit submit there is only one element in the POST array. Can anyone see anything obviously wrong with my code below?
Thank you
Code:
contorller
<?php
class Form extends CI_Controller {
function index()
{
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('market', 'Market Choice', 'required');
if ($this->form_validation->run() == FALSE)
{
$this->load->library('template');
$this->template->load('default','header','inventory');
}
else
{
$this->load->view('formsuccess');
}
}
}
?>
<p>
Hello world! This is where I will put the inventory form..
</p>
form
<?php
$post = array('MCI' => 'Kansas City',
'LIN' => 'Lincoln',
'OMA' => 'Omaha',
'ICT' => 'Wichita',
);
?>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<?php
echo form_fieldset('Choose Market(s)');
echo form_multiselect('market', $post);
echo "<p>Query results will be displayed below.</p>\n";
echo form_submit('mysubmit', 'Submit Query');
echo form_fieldset_close();
formsuccess.php
<html>
<head>
<title>My Form</title>
<?php echo ("<pre>".print_r($_POST,true)."</pre>"); ?>
</head>
<body>
<h3>Your form was successfully submitted!</h3>
<p><?php echo anchor('/home/inventory', 'Try it again!'); ?></p>
</body>
</html>