Welcome Guest, Not a member yet? Register   Sign In
[HELP] Form submit and
#1

[eluser]Darker[/eluser]
http://109.235.69.39/ci/register
click "register" and you can see...
Why ?

register.php controller
Code:
<?
class Register extends CI_Controller {
public function index() {
  $this->load->library('form_validation');
  $this->form_validation->set_rules('first_name', 'First name', 'required');
  $this->form_validation->set_rules('last_name', 'Last name', 'required');
  $this->form_validation->set_rules('username', 'Username', 'callback_checkuser');
  $this->form_validation->set_rules('password', 'Password', 'required');
  $this->form_validation->set_rules('password2', 'Password Confirmation', 'required');
  $this->form_validation->set_rules('email', 'Email', 'required');
  $this->form_validation->set_rules('country', 'Country', 'required');
  $this->form_validation->set_rules('city', 'City', 'required');
  $this->form_validation->set_rules('date_of_birth', 'Date of birth', 'required');
  $this->form_validation->set_rules('agree', 'You must check "I agree with terms and conditions"', 'required');
  if ($this->form_validation->run() == FALSE) {
   $data['action'] = "";
  } else {
   $data['action'] = "register_success";
  }
  $data['page'] = 'pages/register_view';
  $data['temporary_data'] = $data;
  $this->load->view('main_view', $data);
}
function checkuser($username) {
  $this->load->model('user_model');
  $exists = $this->user_model->ifUserExists($username);
  if ($exists) { return FALSE; } else { return TRUE; }
}
}
?>

register_view.php view
Code:
<?
print_r($temporary_data);
if ($action == "register_success") {
    ?>
    <h2>Success!</h2>
    Congratulations, registration successful. We sent you an email with account confirmation link.
    &lt;?
} else {
    $this->load->helper('form');
    echo form_open(base_url() . 'register');
    ?&gt;
    <strong>Fill in registration form</strong>
    <br /><br />
    First name:<br />
    &lt;? echo form_input('first_name'); ?&gt;
    <br />Last name:<br />
    &lt;? echo form_input('last_name'); ?&gt;
    <br />Username:<br />
    &lt;? echo form_input('username'); ?&gt;
    <br />Password:<br />
    &lt;? echo form_password('password'); ?&gt;
    <br />Confirm password:<br />
    &lt;? echo form_password('password2'); ?&gt;
    <br />E-mail address:<br />
    &lt;? echo form_input('email'); ?&gt;
    <br />Country:<br />
    &lt;?
    $options = array(
    '0' => '-- none --', '1' => 'Lithuania',
    '2' => 'Latvia', '3' => 'Estonia');
    echo form_dropdown('country', $options, 'Lithuania');
    ?&gt;
    <br />City:<br />
    &lt;? echo form_input('city'); ?&gt;
    <br />Date of birth:<br />
    &lt;? echo form_input('date_of_birth'); ?&gt;
    <br /><br />
    &lt;? echo form_checkbox('agree', '1', TRUE); ?&gt;
    I agree with terms and conditions
    <br /><br />
    &lt;?
    echo form_submit('submit', ' Register ');
    echo form_close();
}
?&gt;

Thanks for you help.


Messages In This Thread
[HELP] Form submit and - by El Forum - 10-09-2012, 02:03 PM
[HELP] Form submit and - by El Forum - 10-09-2012, 02:21 PM
[HELP] Form submit and - by El Forum - 10-10-2012, 03:17 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 06:54 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 10:00 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 11:15 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 11:50 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 11:57 AM
[HELP] Form submit and - by El Forum - 10-10-2012, 11:58 AM
[HELP] Form submit and - by El Forum - 10-11-2012, 03:46 AM



Theme © iAndrew 2016 - Forum software by © MyBB