[eluser]Unknown[/eluser]
Hi guys, i'm new to codeigniter, and i am doing a project.
I am trying to use the built in validation tools to validate a form. However, the form does not want to validate, even with the proper input. Can anyone tell me what i am doing wrong?
I am using jquery mobile. will this casue my problem?
Below is my code
Controller (named 'mainController.php'):
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class MainController extends CI_Controller {
public function index()
{
$this->load->helper("form");
$this->load->library("form_validation");
$this->form_validation->set_rules("email", "Email Address", "required|valid_email");
$this->form_validation->set_rules("password", "Password", "required");
$this->form_validation->set_rules("institution", "Institution", "required");
if ($this->form_validation->run() == false){
$this->load->view("index");
}
else{
$this->load->view("welcome_message");
}
}
}
?>
View (named 'index.php'):
the removed lines of code are scripts for including jquery and jquery mobile libraries
Code:
<html lang="en">
<head>
<meta name="viewport" c initial-scale=1, maximum-scale=1">
<meta charset="utf-8">
<title>BCC Application - Login</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.min.css" />
[removed][removed]
[removed][removed]
</head>
<body>
<div data-role="page" id="login">
<div data-role="content">
<h1>Application form</h1>
<p>Please log in to view your application</p>
<p><a href="">Don't Have an application? Click to create one</a></p>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<label for="email">Email Address</label>
<input type="text" name="email"><br>
<label for="password">Password</label>
<input type="password" name="password"><br>
<label for="institution">Institution</label>
<select name="institution">
<option>Barbados Community College</option>
<option>Samuel Jackson Prescod Polytechnic</option>
<option>Eridston College</option>
</select><br>
<input type="submit" name="submit" value="Submit">
</form>
</div><!--End content-->
<?php
include("templates/footer.php");
?>
</div><!--End login page-->
</body>
</html>
Thanks in advance for any help