[eluser]sapid_guy[/eluser]
[quote author="TheFuzzy0ne" date="1234367466"]Your code is not clear enough for me to understand correctly.
What are you using print_r on? img_name and img_que do not match the names specified in your form. If you can show us what's
really going on, someone may be able to assist you better.[/quote]
The View
Code:
echo form_open_multipart('lists/lists_home/register_list_det');
echo '<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th>Content ID</th>
<th>Name</th>
<th>date_added</th>
<th>status</th>
<th>Thumb</th>
<th>Select</th>
<th>Queue</th>
</tr>';
foreach ($query_img->result() as $row)
{
echo '<tr>';
echo '<td>';
echo $row->img_id;
echo '</td>';
echo '<td>';
echo $row->img_name;
echo '</td>';
echo '<td>';
echo $row->status;
echo '</td>';
echo '<td>';
echo $row->date_added;
echo '</td>';
$atts = array(
'width' => '800',
'height' => '600',
'scrollbars' => 'yes',
'status' => 'no',
'resizable' => 'no',
'screenx' => '0',
'screeny' => '0'
);
echo '<td>';
echo anchor_popup(base_url().'content/images/'.$row->img_name, '<img >img_name.'" />', $atts);
echo '</td>';
echo '<td>';
echo form_checkbox('name[]', $row->img_name, FALSE);
echo '</td>';
$data_form = array(
'name' => 'queue[]',
'value' => '',
'maxlength' => '2',
'size' => '10',
'style' => 'width:50%',
);
echo '<td>';
//echo form_input('queue','','','2','10','width:50%');
echo form_input($data_form);
//echo '<input type="text" name="queue[]" value="" size="10" maxlength="2" />';
//<input type="text" name="title" value="" size="52" />
echo '</td>';
echo '</tr>';
}
echo '<tr>';
echo '<td>';
echo '--- ---';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Name the List:';
echo '</td>';
echo '<td>';
echo '<input type="text" name="list_name" value="" size="30" />';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '<td>';
echo '<input type="submit" value="Creat List" />';
echo '</td>';
echo '<td>';
echo '-';
echo '</td>';
echo '</tr>';
echo '</form>';
echo '</table>';
The Controller
Not yat Complete
Code:
echo $this->input->post('list_name');
$sql = "INSERT INTO list_img (list_name)
VALUES (".$this->db->escape($this->input->post('list_name'))."
)";
$this->db->query($sql);
$form_data_img = array(
'img_name' => $this->input->post('name'),
);
$form_data_que = array(
'img_que' => $this->input->post('queue')
);
echo count($form_data_img['img_name']);
//exit;
echo '<br /><br />';
print_r($form_data_img);
echo '<br /><br />';
print_r($form_data_que);
echo '<br /><br />';
$i=0;
while($i<count($form_data_img['img_name'])){
echo $form_data_img['img_name'];
echo '<br />';
echo $form_data_que['img_que'];
echo $i++;
}
Am traying to get the data and insert them into a table
the table
CREATE TABLE `list_img` (
`list_id` bigint(20) NOT NULL auto_increment,
`list_name` varchar(100) NOT NULL,
`date_created` timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (`list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `list_img`
--
INSERT INTO `list_img` (`list_id`, `list_name`, `date_created`) VALUES
(1, 'list_img_default', '2009-01-20 22:54:40'),
(2, 'test', '2009-02-11 17:12:35');
-- --------------------------------------------------------
--
-- Table structure for table `list_img_content`
--
CREATE TABLE `list_img_content` (
`id` bigint(20) NOT NULL auto_increment,
`list_id` bigint(20) NOT NULL,
`file_name` varchar(100) NOT NULL,
`queue` int(2) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `list_img_content`
--
INSERT INTO `list_img_content` (`id`, `list_id`, `file_name`, `queue`) VALUES
(1, 1, '2.jpg', 1),
(2, 1, '1.jpg', 2);
If you have noticed the controller still in construction
Because i been trying to solve the issues of the data posted first.
Thanks for the help.