[eluser]snurb[/eluser]
This is the controller:
Code:
class Form extends Controller {
function index() {
#Input and textarea feld attributes
$data['fname'] = array('name' => 'fname', 'id' => 'fname');
$data['email'] = array('name' => 'email', 'id' => 'email');
$data['comments'] = array('name' => 'comments', 'id' => 'comments', 'rows' => 3, 'cols' => 40);
#Checkbox attributes
$data['purpose'] = array('name' => 'seminar[]', 'id' => 'purpose', 'value' => 'Purpose of Prayer', 'checked' => FALSE);
$data['prepare'] = array('name' => 'seminar[]', 'id' => 'prepare', 'value' => 'Prepare for Prayer', 'checked' => FALSE);
$data['principles'] = array('name' => 'seminar[]', 'id' => 'principles', 'value' => 'Principles of Prayer', 'checked' => FALSE);
$data['power'] = array('name' => 'seminar[]', 'id' => 'power', 'value' => 'Power in Prayer', 'checked' => FALSE);
$data['form_action'] = $this->config->site_url().'?c=form&m=submit';
$this->load->view('form_view', $data);
}
}
and a snippet of the view:
Code:
<body>
<h1>Registration Form</h1>
<p>Please complete the following form:</p>
<form method="post" action="<?php echo $form_action; ?>">
<p><label for="fname">Full Name: </label><br /><?php echo form_input($fname); ?></p>
<p><label for="email">E-mail: </label><br /><?php echo form_input($email); ?></p>
<p>Please select one or more seminars, that you would like to attend</p>
<p><?php echo form_checkbox($purpose); ?> <label for="purpose">Purpose of Prayer</label></p>
<p><?php echo form_checkbox($prepare); ?> <label for="prepare">Prepare for Prayer</label></p>
<p><?php echo form_checkbox($principles); ?> <label for="principles">Principles of Prayer</label></p>
<p><?php echo form_checkbox($power); ?> <label for="power">Power in Prayer</label></p>
<p><label for="comments">Comments: </label><br /><?php echo form_textarea($comments); ?></p>
its from godbit tutorial.