Skip to content

Instantly share code, notes, and snippets.

@ckdarby
Created June 6, 2012 00:30
Show Gist options
  • Save ckdarby/2879121 to your computer and use it in GitHub Desktop.
Save ckdarby/2879121 to your computer and use it in GitHub Desktop.
Issue #1328
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* application/controllers/welcome.php
*
*/
class Welcome extends CI_Controller {
public function index()
{
$this->load->helper('form');
$this->load->library('form_validation');
$this->form_validation->set_rules('title', 'Title', 'required|min_length[2]|trim|xss_clean|alpha_dash');
$test_input = $this->input->post();
if(!empty($test_input)) {
$this->load->library('form_validation');
if ($this->form_validation->run() == FALSE)
{
}
}
$this->load->view('welcome_message');
}
}
<!-- application/views/welcome_message.php -->
<div id="container">
<?php
echo validation_errors();
echo form_open('/');
?>
<h5>Title</h5>
<input type="text" name="title" value="" size="50" />
<div><input type="submit" value="Submit" /></div>
</form>
<?
echo form_close();
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment