English 中文(简体)
认证等级
原标题:Codeigniter form validation class

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 , E/CN.6/2009/1。mail 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() == FALSE/CN.6/2009/1。)
    {
        $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">E/CN.6/2009/1。mail 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> );?>

这是它自己的形式。 我不得不在几个小时内发言,这种形式的工作是关键。 感谢一切帮助。

E/CN.6/2009/1。

最佳回答

表格验证规则与观点html要素之间有不匹配的名称。

www.un.org/Depts/DGACM/index_spanish.htm 审定规则

$this->form_validation->set_rules( supportername , Name , trim|required|max_length[30] );

<><><><>>>

$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 /> ;

是否修改了确认规则名称以支持名称

<>>>

更改名称 =>支持名称=>支持名称

问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签