Menu

Non mandatory fields

Help
Phil
2007-04-19
2013-06-03
  • Phil

    Phil - 2007-04-19

    I have created a form to collect up to 6 lines of data in a number of different fields (text boxes, drop down menus and textarea).  Only two of the text boxes are mandatory, the rest are optional.  Consequently, I have only included the "standard" error message script for the two mandatory fields at the start of the .php file.

    However, when I try to run the file (having completed only the mandatory fields), I get the following error message:

    "The following errors occured while processing your form input.
    You did not enter one or more of the required fields. Please go back and try again."

    Can anyone help please?

     
    • TNTEverett

      TNTEverett - 2007-04-19

      You are going to have to look into the process.php file to see what variables are checked and what conditions would result in an error. 
      If you don't know how to do this send me the process.php file and a pointer to the form in an email.  I will help you determine where the error is. 

       
    • TNTEverett

      TNTEverett - 2007-04-19

      The php file needs to be sent as an attachment.  Also the URL to the form does not seem to be valid.

      www.g3swh.org
      "DNS_HOST_NOT_FOUND"

       
    • TNTEverett

      TNTEverett - 2007-04-19

      Simple answer.
      In the form-x.html file:
      Yourcallsign

      In the form.php file:
      yourcallsign

      See the difference?
      Since the form.php file has multiple instances of the variable name the simple solution is to change the one entry in the html file to all lower case.

       
    • Phil

      Phil - 2007-04-19

      Many thanks.  That now works OK.

      Now to get the rest of the oage working!

      Regards

       
    • TNTEverett

      TNTEverett - 2007-04-20

      "All I am getting is the field names and not the data"

      You need to register all the variables you add to the php file.
      pt_register('POST','dxcallsign');
      pt_register('POST','emailaddress');
      pt_register('POST','band1');
      pt_register('POST','mode1');
      pt_register('POST','dd1');
      pt_register('POST','mmm1');
      pt_register('POST','yyyy1');
      pt_register('POST','hour1');
      pt_register('POST','min1');
      pt_register('POST','band2');
      pt_register('POST','mode2');
      pt_register('POST','dd2');
      pt_register('POST','mmm2');
      pt_register('POST','yyyy2');
      pt_register('POST','hour2');
      pt_register('POST','min2');

       
    • Phil

      Phil - 2007-04-20

      Does that not make them mandatory?  Or am I misunderstanding (again)?

      Regards

       
      • TNTEverett

        TNTEverett - 2007-04-20

        Register does not mean mandatory.  Mandatory variables are handled with error conditions like this one.

        if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){
        $error.="<li>Invalid email address entered";
        $errors=1;
        }

        or this one

        if($FirstName=="" || $LastName==""){
        $errors=1;
        $error.="<li>You did not enter one or more of the required fields. Please go back and try again."; }

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.