Welcome Guest, Not a member yet? Register   Sign In
validation error
#5

[eluser]razerone[/eluser]
[quote author="Tpojka" date="1383217903"]You are not doing something well.
Basic school example is working for me:

Code:
class Form extends CI_Controller {

function index()
{
  $this->load->helper(array('form', 'url'));

  $this->load->library('form_validation');

  $this->form_validation->set_rules('username', 'Username', 'required');
  $this->form_validation->set_rules('password', 'Password', 'required');
  $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required');
  $this->form_validation->set_rules('email', 'Email', 'required');

  if ($this->form_validation->run() == FALSE)
  {
   $this->load->view('myform');
  }
  else
  {
   $this->load->view('formsuccess');
  }
}
}

Code:
<html>
<head>
<title>My Form</title>
</head>
<body>

<?php echo form_open('form'); ?>

<h5>Username</h5>
&lt;?php echo form_error('username'); ?&gt;
&lt;input type="text" name="username" value="&lt;?php echo set_value('username'); ?&gt;" size="50" /&gt;

<h5>Password</h5>
&lt;?php echo form_error('password'); ?&gt;
&lt;input type="text" name="password" value="&lt;?php echo set_value('password'); ?&gt;" size="50" /&gt;

<h5>Password Confirm</h5>
&lt;?php echo form_error('passconf'); ?&gt;
&lt;input type="text" name="passconf" value="&lt;?php echo set_value('passconf'); ?&gt;" size="50" /&gt;

<h5>Email Address</h5>
&lt;?php echo form_error('email'); ?&gt;
&lt;input type="text" name="email" value="&lt;?php echo set_value('email'); ?&gt;" size="50" /&gt;

<div>&lt;input type="submit" value="Submit" /&gt;&lt;/div>

&lt;/form&gt;

&lt;/body&gt;
&lt;/html&gt;
Code:
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My Form&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

<h3>Your form was successfully submitted!</h3>

<p>&lt;?php echo anchor('form', 'Try it again!'); ?&gt;</p>

&lt;/body&gt;
&lt;/html&gt;
[/quote]

Thanks will give it ago just slowly teaching my self going through userguide


Messages In This Thread
validation error - by El Forum - 10-30-2013, 10:45 PM
validation error - by El Forum - 10-31-2013, 03:04 AM
validation error - by El Forum - 10-31-2013, 03:11 AM
validation error - by El Forum - 10-31-2013, 04:11 AM
validation error - by El Forum - 10-31-2013, 04:32 AM
validation error - by El Forum - 10-31-2013, 04:34 AM
validation error - by El Forum - 10-31-2013, 04:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB