Jump to content

PHP Form calculation


JMack

Recommended Posts

I know have this form but it doesn't calculate right it only puts 1 in the total states box and it put the amount of one in the total price box. help not sure what is wrong?

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<script type="text/javascript">

function MM_jumpMenu(targ,selObj,restore){ //v3.0

  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");

  if (restore) selObj.selectedIndex=0;

}

</script>

<style type="text/css">

div {

    text-align: left;

}

</style>

</head>

 

<body>

 

<a name="result"></a>

<form action="orderprocess.php" method="post">

<div id="netFormTitle">Biz Partners Referral Registration</div>

 

    <div class="blockSubtitle netTextColor">Promote Your Business-to-Business Product and Services</div>

 

    <div>Leverage the BUZGate business-to-business referral network to generate leads and increase sales among small and medium-sized business. An interactive listing is less than $8.00 per month, per state.</div>

 

    <div>Use the form below to choose what state(s) you want your listing to appear in and our marketing team will publish your business information and email you for content/link confirmation. </div>

 

    <div><strong> Pricing:</strong> $89.95 per state per year, plus $29.95 w/logo. Multiple state discounts available.</div>

 

    <div>

 

      <p><span class="bold">*</span>Required Fields are marked with an asterisk and highlighted</p>

      <p>

        <legend>Contact and Listing Information</legend></p>

      <div class="fhFormLeft2">

      <!-- HACK: HAD TO USE MARGIN TOP, VERTICAL-ALIGN:MIDDLE; DOESN'T WORK --></div>

    </div>

 

  <p>*Industry Category

  <br/>

 

    <select name="Industry Category" id="Industry Category">

      <option>Accounting</option>

      <option>Angel Funding</option>

      <option>Business Coaching</option>

      <option>    Computer HardwareCredit Programs</option>

      <option>Credit Reporting</option>

 

      <option>CRM</option>

      <option>Data Backup and Recovery</option>

      <option>Distance Learning</option>

      <option>E-commerce</option>

      <option>Employment / HR</option>

      <option>Factoring</option>

 

      <option>Financial Consultants</option>

      <option>Financial Institutions</option>

      <option>Franchise Opportunites</option>

      <option>Funding Sources</option>

      <option>Graphic Design</option>

      <option>eMail Marketing</option>

 

      <option>Information Technology</option>

      <option>Insurance</option>

      <option>Leasing</option>

      <option>Legal Services</option>

      <option>Mailing Solutions</option>

      <option>Management Consulting</option>

 

      <option>Marketing & P.R.</option>

      <option>Mediation & Dispute Resolution</option>

      <option>Merchant Services</option>

      <option>Newspapers / Publications</option>

      <option>Office & Conference</option>

 

      <option>Printing / Copying</option>

      <option>Real Estate</option>

      <option>Retirement Planning</option>

      <option>Sales Consulting/Svc</option>

      <option>Search Engine Optimization (SEO)</option>

      <option>Shipping / Courier</option>

 

      <option>Software</option>

      <option>Telecom / ISP</option>

      <option>Transportation</option>

      <option>Travel</option>

      <option>Utilities</option>

      <option>Venture Capital</option>

 

      <option>Web Conferencing</option>

      <option>Websites & Hosting</option>

  </select>

  <div class="fhFormLeft2">

    <label for="CompanyName" class="Label">*Company Name</label>

  </div>

  <div class="fhFormRight2">

 

    <input type="text" name="CompanyName" id="CompanyName"

      value="" size="40" maxlength="100" />

   

  </div>

  <div class="fhFormLeft2">

    <label for="Address1" class="Label">*Address 1</label></div>

 

  <div class="fhFormRight2">

    <input type="text" name="Address1" id="Address1"

      value="" size="40" maxlength="50" />

 

  </div>

  <div class="fhFormLeft2">

 

    <label for="Address2" class="Label">Address 2</label>

  </div>

  <div class="fhFormRight2">

    <input type="text" name="Address2" id="Address2"

      value="" size="40" maxlength="50"

      onfocus="statusBarMsg('Enter additional address information if needed.');"

      onblur="window.status='';" />

  </div>

  <div class="fhFormLeft2">

    <label for="City" class="Label">*City</label>

  </div>

 

  <div class="fhFormRight2">

    <input type="text" name="City" id="City"

      value="" size="40" maxlength="50"

      onfocus="statusBarMsg('What is your city?');"

      onblur="window.status='';" class="required" />

  </div>

  <div class="fhFormLeft2">

    </div>

  <p>*State

    <select name="State" id="State">

      <option selected="selected">AK</option>

      <option>AL</option>

 

      <option>AR</option>

      <option>AZ</option>

      <option>CA</option>

<option>CO</option>

<option>CT</option>

<option>DC</option>

<option>DE</option>

 

<option>FL</option>

<option>GA</option>

<option>HI</option>

<option>IA</option>

<option>ID</option>

<option>IL</option>

<option>IN</option>

<option>KS</option>

<option>KY</option>

 

<option>LA</option>

<option>MA</option>

<option>MD</option>

<option>ME</option>

<option>MI</option>

<option>MN</option>

<option>MO</option>

<option>MS</option>

<option>MT</option>

 

<option>NC</option>

<option>ND</option>

<option>NE</option>

<option>NH</option>

<option>NJ</option>

<option>NM</option>

<option>NV</option>

<option>NY</option>

<option>OH</option>

 

<option>OK</option>

<option>OR</option>

<option>PA</option>

<option>PR</option>

<option>RI</option>

<option>SC</option>

<option>SD</option>

<option>TN</option>

 

<option>TX</option>

  <option>UT</option>

  <option>VA</option>

<option>VT</option>

<option>WA</option>

<option>WI</option>

 

<option>WV</option>

<option>WY</option>

  <option>Other</option>

    </select>

 

  <div class="fhFormLeft2">

      <label for="Zip" class="Label">*Zip/Postal Code</label>

   

            </div>

 

     

            <div class="fhFormRight2">

          <input type="text" name="Zip" id="Zip"

          value="" size="10" maxlength="15"

          onfocus="statusBarMsg(sWorldPostalCode)"

          onblur="window.status='';"

          onchange="if(!isZIPCode(stripCharsInBag(this.value, ZIPCodeDelimiters))){checkPostalCode(this, false)};"

          class="required" />

            </div>

     

            <div class="fhFormLeft2">

      <label for="WebAddress" class="Label">Web Address:</label>

   

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="WebAddress" id="WebAddress"

      value=""

      size="40"

      onfocus="statusBarMsg('If more than one, you can enter multiple addresses separated by commas.')"

      onblur="window.status='';" >

 

            </div>

     

            <div class="fhFormLeft2">

      <label for="FirstName" class="Label">*First Name</label>

   

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="FirstName" id="FirstName"

      value="" size="40" maxlength="50"

      onchange="if(isItEmpty(this.value)) {

      alertMsg(this.form.name,this.name,'Please tell us your first name (given name).');}"

      class="required" />

            </div>

     

            <div class="fhFormLeft2">

 

      <label for="LastName" class="Label">*Last Name</label>

   

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="LastName" id="LastName"

      value="" size="40" maxlength="50"

      onchange="if(isItEmpty(this.value)) {

      alertMsg(this.form.name, this.name, 'Please tell us your last name (family name).');}"

      class="required" />

            </div>

     

            <div class="fhFormLeft2">

      <label for="Title" class="Label">Title</label>

   

            </div>

 

     

            <div class="fhFormRight2">

      <input type="text" name="Title" id="Title"

      value="" size="40" maxlength="50" />

            </div>

     

            <div class="fhFormLeft2">

      <label for="Email" class="Label">*Email</label>

   

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="Email" id="Email"

      value="" size="40" maxlength="50"

      onfocus="statusBarMsg('Please enter your work email address.')"

      onblur="window.status='';" onchange="checkEmail(this,false);"

      class="required" />

 

            </div>

     

            <div class="fhFormLeft2">

      <label for="PhoneBiz" class="Label">*Business Phone</label>

 

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="PhoneBiz" id="PhoneBiz"

      value=""

      size="15" maxlength="30"

      onfocus="statusBarMsg('Enter a 10-digit US phone, or an International phone number starting with +.')"

      onblur="window.status='';"

      onchange="normalizedPhone = stripCharsInBag (this.value, phoneNumberDelimiters);

      if (isUSPhoneNumber (normalizedPhone, false)) { this.value = reformatUSPhone (normalizedPhone); }"

      class="required" />

            </div>

     

            <div class="fhFormLeft2">

 

      <label for="PhoneFax" class="Label">Fax</label>

   

            </div>

     

            <div class="fhFormRight2">

      <input type="text" name="PhoneFax" id="PhoneFax"

      value="" size="15"

      onfocus="statusBarMsg('Enter a 10-digit US phone, or an International phone number starting with +.')"

      onblur="window.status='';"

      onchange="normalizedPhone = stripCharsInBag (this.value, phoneNumberDelimiters);

      if (isUSPhoneNumber (normalizedPhone, false)) {

      this.value = reformatUSPhone (normalizedPhone); }" maxlength="30" />

        </div>

      </fieldset>

 

      <div>Briefly describe your business offerings. This information will be used as a reference by our professional marketing team to create the interactive listing copy.</div>

 

     

        <div>

      <label for="Comments" class="Label">

      *Description<br />(limit 1,000 words)<br />

          <textarea name="Comments" id="Comments" onfocus="statusBarMsg('Additional Comments')" onblur="window.status='';" rows="3" cols="60" onchange="limitWords(this.form.Comments, 1000);" class="required">

            </textarea>

      </label>

        </div>

        <div>

 

        Pricing per State:<br/>

        $89.95 per state up to 9 states<br/>

            $59.95 per state up to 24 states<br/>

            24 and national listings (All 50 states plus DC and Puerto Rico), $39.95 per state </p>

      </div>

      <div>

      <fieldset class="required">

 

        <legend>*Check State(s) Served</legend>

      <?php

$totalProducts = count($_post['Region']);

$productPrice = 89.95;

$discountfor10to24 = 30.00;

$discountfor25to52 = 50.00;

 

$discount = ($totalProducts = 10 && $totalProducts < 25) ? $discountfor10to24 : (($totalProducts > 24) ? $discountfor25to52 : 0);

 

$total = ($productPrice * $totalProducts) - $discount;

 

?>

        <table border="0" cellpadding="0">

          <tr>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="AK" />

              AK<br />

              <input type="checkbox" name="Region[]" value="AL" />

 

              AL<br />

              <input type="checkbox" name="Region[]" value="AR" />

              AR<br />

              <input type="checkbox"  name="Region[]" value="AZ" />

              AZ<br />

              <input type="checkbox" name="Region[]" value="CA" />

              CA</p></td>

 

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="CO" />

              CO<br />

              <input type="checkbox" name="Region[]" value="CT" />

              CT<br />

              <input type="checkbox" name="Region[]" value="DC" />

              DC<br />

 

              <input type="checkbox" name="Region[]" value="DE" />

              DE<br />

              <input type="checkbox" name="Region[]" value="FL" />

              FL</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="GA" />

              GA<br />

 

              <input type="checkbox" name="Region[]" value="HI" />

              HI<br />

              <input type="checkbox" name="Region[]" value="IA" />

              IA<br />

              <input type="checkbox" name="Region[]" value="ID" />

              ID<br />

              <input type="checkbox" name="Region[]" value="IL" />

 

              IL</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="IN" />

              IN<br />

              <input type="checkbox" name="Region[]" value="KS" />

              KS<br />

              <input type="checkbox" name="Region[]" value="KY" />

 

              KY<br />

              <input type="checkbox" name="Region[]" value="LA" />

              LA<br />

              <input type="checkbox" name="Region[]" value="MA" />

              MA</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="MD" />

 

              MD<br />

              <input type="checkbox" name="Region[]" value="ME" />

              ME<br />

              <input type="checkbox" name="Region[]" value="MI" />

              MI<br />

              <input type="checkbox" name="Region[]" value="MN" />

              MN<br />

 

              <input type="checkbox" name="Region[]" value="MO" />

              MO</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="MS" />

              MS<br />

              <input type="checkbox" name="Region[]" value="MT" />

              MT<br />

 

              <input type="checkbox" name="Region[]" value="NC" />

              NC<br />

              <input type="checkbox" name="Region[]" value="ND" />

              ND<br />

              <input type="checkbox" name="Region[]" value="NE" />

              NE</p></td>

            <td><p align="center">

 

              <input type="checkbox" name="Region[]" value="NH" />

              NH<br />

              <input type="checkbox" name="Region[]" value="NJ" />

              NJ<br />

              <input type="checkbox" name="Region[]" value="NM" />

              NM<br />

              <input type="checkbox" name="Region[]" value="NV" />

 

              NV<br />

              <input type="checkbox" name="Region[]" value="NY" />

              NY</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="OH" />

              OH<br />

              <input type="checkbox" name="Region[]" value="OK" />

 

              OK<br />

              <input type="checkbox" name="Region[]" value="OR" />

              OR<br />

              <input type="checkbox" name="Region[]" value="PA" />

              PA<br />

              <input type="checkbox" name="Region[]" value="PR" />

              PR</p></td>

 

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="RI" />

              RI<br />

              <input type="checkbox" name="Region[]" value="SC" />

              SC<br />

              <input type="checkbox" name="Region[]" value="SD" />

              SD<br />

 

              <input type="checkbox" name="Region[]" value="TN" />

              TN<br />

              <input type="checkbox" name="Region[]" value="TX" />

              TX</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="UT" />

              UT<br />

 

              <input type="checkbox" name="Region[]" value="VA" />

              VA<br />

              <input type="checkbox" name="Region[]" value="VT" />

              VT<br />

              <input type="checkbox" name="Region[]" value="WA" />

              WA<br />

              <input type="checkbox" name="Region[]" value="WI" />

 

              WI</p></td>

            <td><p align="center">

              <input type="checkbox" name="Region[]" value="WV" />

              WV<br />

              <input type="checkbox" name="Region[]" value="WY" />

              WY</p></td>

          </tr>

 

        </table>

      </fieldset>

        </div>

    <div> 

    <input type="checkbox" name="logo" id="logo" />

    Check box if to include optional logo  placement $24.95 per year</div>

    <p>

      <label>Your total States = </label>

 

      <input name="totalProducts"  type="text"  value="" maxlength="18" /> <br />

      <label>Your total order = </label>

      <input name="total"  type="text"  value="" maxlength="12" />

    </p>

    <p align="center">

      <input type="submit" name="calculate" id="submit" value="calculate" / ">

      <input name="Clear" type="button" value="Clear" />

    <br />

 

   

      </p>

<div class="fhFormLeft2"><label for="SecureCode" class="Label">*Anti-Spam code</label>

        <?php print $Error['SecureCode'] ; ?>

    </div>

    <div class="fhFormRight2">

    <input type="text" name="SecureCode" id="SecureCode"

    value="" size="6" maxlength="6"

    class="required"

    onChange="if(isItEmpty(this.value)) {alertMsg(this.form.name,this.name,'Please enter the anti-spam code to submit this form.');}">

    <?php

    if ($_SESSION['secureImages'] > '') {

        print '  ' . $_SESSION['secureImages'];

    }

    ?> 

    <br />

 

    </div>

     

     

        <div>

        <br /><br />

        </div>

     

        <div>

      <label for="CC" class="Label">

        <input type="checkbox" name="CC" id="CC" value="sentCarbonCopy" checked> Check here to receive a copy of this form (at the above email address).

      </label>

        </div>

 

        <div><span style="text-align: center">

      <label for="Reset" class="Label">

        <input type="reset" name="Reset"

        id="Reset" value="Clear" />

      </label>

         

 

      <input name="Action" type="hidden" value="processForm" />

      <label for="Submit" class="Label">

        <input type="submit" name="Submit"

        id="Submit" value="Submit Form" />

      </label>

      </span></p>

 

        </div>

 

 

 

  </form>

</body>

</html>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.