Welcome Guest, Not a member yet? Register   Sign In
form validation help
#1

[eluser]dadamssg[/eluser]
I'm going through the users guide tutorial over form validation but i wanted to add my own form validation. First of all, does the form validation code go inside the controller? second what am i doing wrong here? I just want to check to see if the username of the field was entered as Bob...if not reload the page, if so go to google. Heres my controller script
Code:
<?php

class Form extends Controller {

    function index()
    {
        $data['title'] = "My Form Title";
        $data['heading'] = "My Form Heading";

        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('validation');
        if($_POST['usernmae'] !== "Bob")
        {
        $this->load->view('form_view', $data);
        }
        else
        {
        redirect('http://www.google.com');
        }
    }
    
}

?>


Messages In This Thread
form validation help - by El Forum - 01-07-2010, 12:38 PM
form validation help - by El Forum - 01-07-2010, 02:58 PM
form validation help - by El Forum - 01-07-2010, 03:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB