I'm learning PHP Codeigniter, especially on Form-Validation. All of my source code are copy pasted from their website and nothing changed (it just copy-paste). This Form Validation seems pretty simple, However every time i click the "submit button" then appear blank page. The Codes are :
MyForm.php (View)
<html>
<head>
<title>My Form</title>
</head>
<body>
<?php echo validation_errors(); ?>
<?php echo form_open('form'); ?>
<h5>Username</h5>
<input type="text" name="username" value="" size="50" />
<h5>Password</h5>
<input type="text" name="password" value="" size="50" />
<h5>Password Confirm</h5>
<input type="text" name="passconf" value="" size="50" />
<h5>Email Address</h5>
<input type="text" name="email" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
</body>
</html>
FormSuccess.php (Success Page):
<html>
<head>
<title>My Form</title>
</head>
<body>
<h3>Your form was successfully submitted!</h3>
<p><?php echo anchor('form', 'Try it again!'); ?></p>
</body>
</html>
And Form.php (Controller) :
<?php
class Form extends CI_Controller {
public 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',
array('required' => 'You must provide a %s.')
);
$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');
}
}
}
If my code works, after i click submit button then it should go to Success Page (formsuccess.php) but now it return blank page.
The Form SS :
I've tried to change webserver to XAMPP, but still face same problem...
Thanks before, for your help...