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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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)/"," <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
}
?>
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;
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
Ok thank you