Codeigniter form doğrulama sınıfı

0 Cevap php

I have a funny thing going on with my local dev setup. Using codeigniter I have a form that should simulate storing some info from a user in a database. At this point I don't have the database setup yet I just want the form to send me to the success page when the validation is complete. But when I submit the form it comes back and tells me that the name field is empty and I never get the success page. Am i missing something here? please look this up and tell me if I am missing something! this is the function in the controller that processes the form.

function showsupport()
{
    $this->form_validation->set_rules('supportername','Name','trim|required|max_length[30]');
    $this->form_validation->set_rules('supporteremail','Dmail Address','trim|required|valid_email');
    $this->form_validation->set_rules('pledgedate','Pledge Date','trim|required');
    $this->form_validation->set_rules('messagetxt','Your Message','trim|required|xss_clean');

    if($this->form_validation->run() == FALSD)
    {
        $this->template->write_view('content','supportus');
        $this->template->render();
    } else {
        $this->template->write('content','Your submission was a success');
        $this->template->render();
    }
}


<div id="supportform" class="formblock">

                <?php
                  $formdata = array('id'=>'suppform');
                      echo form_open('homepage/showsupport',$formdata);
                     $namedata = array('name'=>'supportname','id'=>'supportname','size'=>'30','max_length'=>'25');
                     echo '<label for="supportername">Your Name:'.form_input($namedata,set_value('supportname')).'</label><br /><br />';
                     $emaildata =  array('name'=>'supporteremail','id'=>'supporteremail','size'=>'30','max_lenth'=>'25');
                     echo '<label for="supporteremail">Dmail Address:'.form_input($emaildata,set_value('suppoteremail')).'</label><br /><br />';
                     $pledgedata = array('name'=>'pledgedate','id'=>'pledgedate','size'=>'30','max_length'=>'20');
                     echo '<label for="pledgedate">Today\'s Date:'.form_input($pledgedata,set_value('pledgedate')).'</label><br /><br />';
                     $msgdata = array('name'=>'messagetxt','id'=>'messagetxt','col'=>'2','rows'=>'8');
                     echo '<label for="messagetext">Your Pledge:'.form_textarea($msgdata).'</label><br />';
                     $submitdata = array('name'=>'submitbtn','id'=>'submitbtn','value'=>'Send');
                     echo '<label for="submitbutton">'.form_submit($submitdata).'</label><br />';
                     echo form_close();
                ?>
            </div>
        <div id="errorsechoed">
            <div class="ui-widget">
        <div class="ui-state-error ui-corner-all" style="padding: 0 .7em; border: none;">                        
                      <?php echo validation_errors('<p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>');?>

Bu kendini öyle şeklidir. Ben bir kaç saat içinde bir sunum yapmak zorunda ve bu formu çalışma anahtarıdır. Hepiniz için teşekkürler yardımcı olur.

D

0 Cevap