Menu

How to change the *required fields back

Help
Jay
2009-01-22
2013-06-03
  • Jay

    Jay - 2009-01-22

    Is it possible to change a certain field I mistakenly marked as "*required", to a "normal" field where it does not matter if they fill it out or not? If so can you please tell me what lines to edit or remove.. Thank you =P

     
    • Jay

      Jay - 2009-01-22

      Here is the PhP Code, it may make it easier to pin point where to edit. Thanks

      <?php
      include("global.inc.php");
      $errors=0;
      $error="The following errors occured while processing your form input.<ul>";
      pt_register('POST','FirstName');
      pt_register('POST','LastName');
      pt_register('POST','Title');
      pt_register('POST','Email');
      pt_register('POST','CompanyName');
      pt_register('POST','Position');
      pt_register('POST','MailingAddress');
      pt_register('POST','City');
      pt_register('POST','PostalCode');
      pt_register('POST','StateorProvince');
      pt_register('POST','Country');
      pt_register('POST','MainPhone');
      pt_register('POST','Fax');
      pt_register('POST','CompanyWebsite');
      pt_register('POST','MembershipCategory');
      pt_register('POST','AdditionalComments');
      $AdditionalComments=preg_replace("/(\015\012)|(\015)|(\012)/","&nbsp;<br />", $AdditionalComments);if($FirstName=="" || $LastName=="" || $Title=="" || $Email=="" || $CompanyName=="" || $Position=="" || $MailingAddress=="" || $City=="" || $PostalCode=="" || $StateorProvince=="" || $Country=="" || $MainPhone=="" || $MembershipCategory=="" || $AdditionalComments=="" ){
      $errors=1;
      $error.="<li>You did not enter one or more of the required fields. Please go back and try again.";
      }
      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;
      }
      if($errors==1) echo $error;
      else{
      $where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
      $message="First Name: ".$FirstName."
      Last Name: ".$LastName."
      Title: ".$Title."
      Email: ".$Email."
      Company Name: ".$CompanyName."
      Position: ".$Position."
      Mailing Address: ".$MailingAddress."
      City: ".$City."
      Postal Code: ".$PostalCode."
      State or Province: ".$StateorProvince."
      Country: ".$Country."
      Main Phone: ".$MainPhone."
      Fax: ".$Fax."
      Company Website: ".$CompanyWebsite."
      Membership Category: ".$MembershipCategory."
      Additional Comments: ".$AdditionalComments."
      ";
      $message = stripslashes($message);
      mail("youremail@gmail.com","Form Submitted at your website",$message,"From: phpFormGenerator");
      $make=fopen("admin/data.dat","a");
      $to_put="";
      $to_put .= $FirstName."|".$LastName."|".$Title."|".$Email."|".$CompanyName."|".$Position."|".$MailingAddress."|".$City."|".$PostalCode."|".$StateorProvince."|".$Country."|".$MainPhone."|".$Fax."|".$CompanyWebsite."|".$MembershipCategory."|".$AdditionalComments."
      ";
      fwrite($make,$to_put);
      ?>

      <!-- This is the content of the Thank you page, be careful while changing it -->

      <h2>Thank you!</h2>

      <table width=50%>
      <tr><td>First Name: </td><td> <?php echo $FirstName; ?> </td></tr>
      <tr><td>Last Name: </td><td> <?php echo $LastName; ?> </td></tr>
      <tr><td>Title: </td><td> <?php echo $Title; ?> </td></tr>
      <tr><td>Email: </td><td> <?php echo $Email; ?> </td></tr>
      <tr><td>Company Name: </td><td> <?php echo $CompanyName; ?> </td></tr>
      <tr><td>Position: </td><td> <?php echo $Position; ?> </td></tr>
      <tr><td>Mailing Address: </td><td> <?php echo $MailingAddress; ?> </td></tr>
      <tr><td>City: </td><td> <?php echo $City; ?> </td></tr>
      <tr><td>Postal Code: </td><td> <?php echo $PostalCode; ?> </td></tr>
      <tr><td>State or Province: </td><td> <?php echo $StateorProvince; ?> </td></tr>
      <tr><td>Country: </td><td> <?php echo $Country; ?> </td></tr>
      <tr><td>Main Phone: </td><td> <?php echo $MainPhone; ?> </td></tr>
      <tr><td>Fax: </td><td> <?php echo $Fax; ?> </td></tr>
      <tr><td>Company Website: </td><td> <?php echo $CompanyWebsite; ?> </td></tr>
      <tr><td>Membership Category: </td><td> <?php echo $MembershipCategory; ?> </td></tr>
      <tr><td>Additional Comments: </td><td> <?php echo $AdditionalComments; ?> </td></tr>
      </table>
      <!-- Do not change anything below this line -->

      <?php
      }
      ?>

       
      • TNTEverett

        TNTEverett - 2009-01-22

        In the processor.php file you will find this line.

        if($FirstName=="" || $LastName=="" || $Title=="" || $Email==""
        || $CompanyName=="" || $Position=="" || $MailingAddress=="" || $City==""
        || ||
        $PostalCode=="" || $StateorProvince=="" || $Country=="" || $MainPhone=="" || $MembershipCategory=="" || $AdditionalComments=="" ){ $errors=1;

        To remove field "LastName" from the required list make the following change. 

        if($FirstName=="" || $Title=="" || $Email==""
        || $CompanyName=="" || $Position=="" || $MailingAddress=="" || $City=="" || $PostalCode=="" || $StateorProvince=="" || $Country=="" || $MainPhone=="" || $MembershipCategory=="" || $AdditionalComments=="" ){ $errors=1;

         
    • TNTEverett

      TNTEverett - 2009-01-22

      At the bottom of your form you will find something like this:
      if (validateField('field_1','fieldBox_1','menu',1) == false)

      After the word 'memu' you see the number 1. 
      1 = required
      0 = not required

       
    • Jay

      Jay - 2009-01-22

      Ok thank you

       

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.