Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    EASY CODING problem

    OK, I want o be able to display the total from the variables collected in the forms.. My PHP is at the bottom... BASCIALLY, if they choose to pay for it monthly, it the price stays the same, if they want to pay for it quarterly then they get 5% off and if they pay for it yearly, then they get 15% off the total. I want to be able to display the total inclduing the teh % that was taken off based on the what payment plan they selected... COuld someone check my code? For some reason it isn;t grabbing the vaules form the forms... Also, how can make the total into a variable that can be sent by the form when it gets sent my e-mail address?

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



    Code:
     <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    .style3 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
    -->
    </style>
    </head>
    
    <body>
    
    
    <form name="joinform" method="post" action="join.php" onsubmit="javascript:if(confirm('All infomation stated on this page is correct? Are you are you wish to continue?')) document.joinform.submit(); else return false;">
    <input type="hidden" name="sent" value="1">
    <input type="hidden" name="ip" value="<?=$_SERVER['REMOTE_ADDR']?>">
      
      <table width="700" border="1" cellpadding="2" cellspacing="0" bordercolor="#CCCCCC">
        <tr> 
          <td><span class="style3"><strong>Name:</strong></span></td>
          <td width="60%"><input style="width: 60%; background: #CCCCCC" type="text" name="name"></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>E-Mail Address:</strong></span></td>
          <td width="60%"><input style="width: 60%; background: #CCCCCC" type="text" name="email"> 
          </td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>PayPal Address:</strong></span></td>
          <td width="60%"><input style="width: 60%; background: #CCCCCC" type="text"  name="paypaladdress"></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>Game:</strong></span></td>
          <td width="60%"><select name="gametype">
              <option value="Counter-Strike">Counter-Strike</option>
              <option value="Condition-Zero">CS: Condition-Zero</option>
              <option value="Day Of Defeat">Day Of Defeat</option>
              <option value="Call Of Duty">Call Of Duty</option>
              <option value="Natural Selection">Natural Selection</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>Public or Private:</strong></span></td>
          <td width="60%"><select name="puborpriv">
              <option value="public">Public</option>
              <option value="private">Private</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>If Public Server Selected</strong>( Select 
            Size ):</span></td>
          <td width="60%"><select name="pubsize">
              <option value="0">CHOOSE SIZE</option>
              <option value="42">12 ($42)</option>
              <option value="49">14 ($49)</option>
              <option value="56">16 ($56)</option>
              <option value="63">18 ($63)</option>
              <option value="70">20 ($70)</option>
              <option value="77">22 ($77)</option>
              <option value="105">30 ($105)</option>
              <option value="112">32 ($112)</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>If Private Server Selected</strong>(<strong> 
            </strong>Select Size ):</span></td>
          <td width="60%"><select name="privsize">
              <option value="0">CHOOSE SIZE</option>
              <option value="20">12 ($20)</option>
              <option value="50">20 ($50)</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>Location:</strong></span></td>
          <td width="60%"><select name="location">
              <option value="california">San Fran, California</option>
              <option value="texas">Dallas, Texas</option>
              <option value="newyork">Long Island, NY</option>
              <option value="newjersey">Parsippany, NJ</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>AMX/ADMINMOD</strong>( Check both or AMX 
            or Adminmod ):</span></td>
          <td width="60%"><font size="2" face="Arial, Helvetica, sans-serif"> 
            <input type="checkbox" name="amxmod" value="yes">
            AMX Mod ( No Extra Cost ) 
            <input type="checkbox" name="adminmod" value="yes">
            Adminmod ( No Extra Cost )</font></td>
        </tr>
        <tr> 
          <td><font size="2" face="Arial, Helvetica, sans-serif"><span class="style3"><strong>Statsme</strong>( 
            Check to be installed ):</span></font></td>
          <td width="60%"><font size="2" face="Arial, Helvetica, sans-serif"> 
            <input type="checkbox" name="statsme" value="yes">
            Statsme Mod ( No Extra Cost )</font></td>
        </tr>
        <tr> 
          <td><font size="2" face="Arial, Helvetica, sans-serif"><strong>HLGuard</strong>( 
            Check to be installed ):</font></td>
          <td width="60%"><font size="2" face="Arial, Helvetica, sans-serif"> 
            <input type="checkbox" name="hlguard" value="yes">
            HLGuard Mod ( No Extra Cost )</font></td>
        </tr>
        <tr> 
          <td><span class="style3"><strong>Extra Mods</strong>( Type in any other 
            mods you wish to be installed ):</span></td>
          <td width="60%"><textarea style="width: 80%; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: xx-small; background: #CCCCCC" rows="8" name="extramods">Type Extra Mods Here ( No Extra Charge )</textarea></td>
        </tr>
        <tr> 
          <td><span class="style3">Payment Plan:</span></td>
          <td width="60%"><select name="payplan">
              <option value="1">Monthly</option>
              <option value="2">Quarterly 5% Off</option>
              <option value="3">Yearly 15% Off</option>
            </select></td>
        </tr>
        <tr> 
          <td><span class="style3">Server Name:</span></td>
          <td width="60%"><input style="width: 60%; background: #CCCCCC" type="text" name="servername"> 
          </td>
        </tr>
        <tr> 
          <td><span class="style3">Rcon Password:</span></td>
          <td><input style="width: 60%; background: #CCCCCC" type="text" name="rcnpwd"> 
          </td>
        </tr>
        <tr> 
          <td><span class="style3">FTP Password:</span></td>
          <td><input style="width: 60%; background: #CCCCCC" type="text" name="ftppwd"> 
          </td>
        </tr>
        <tr> 
          <td><span class="style3">Server Password( Only if its a Private ):</span></td>
          <td><input style="width: 60%; background: #CCCCCC" type="text" name="prviserverpwd"></td>
        </tr>
        <tr bgcolor="#CCCCCC"> 
          <td height="60" colspan="2"><div align="right"> 
              <p><strong><font size="2" face="Arial, Helvetica, sans-serif">Your TOTAL: $
     <?php 
        if(puborprive == public){ 
           if( payplan == 1){ 
              $number = pubsize;
              echo "$number";
            } if else( payplan == 2 ) { 
               $percentage = 0.05;
    		   $number = pubsize;
    		   $yeartotal = $number * 12;
    		   $total =  $yeartotal * $percentage;
    		   echo "$number"
            } else {
    		   $percentage = 0.15;
    		   $number = pubsize;
    		   $yeartotal = $number * 12;
    		   $total =  $yeartotal * $percentage;
    		   echo "$number"
    		}  
     
    } else { 
         if( payplan == 1){ 
              $number = privsize;
              echo "$number";
            } if else( payplan == 2 ) { 
               $percentage = 0.05;
    		   $number = privesize;
    		   $yeartotal = $number * 12;
    		   $total =  $yeartotal * $percentage;
    		   echo "$number"
            } else {
    		   $percentage = 0.15;
    		   $number = privsize;
    		   $yeartotal = $number * 12;
    		   $total =  $yeartotal * $percentage;
    		   echo "$number"
    		}   
    } 
    ?> 
                </font></strong></p>
              <p>&nbsp; </p>
            </div></td>
        </tr>
      </table>
    
      <br>
    <center><INPUT TYPE="submit" VALUE="submit"></center>
    </form>
    </body>
    </html>

    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    I am wondering fi this would be eaier in javascript or PHP?

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Aye, I seen your question posted here also but that is PHP you are using there, not javascript....


    .....Willy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •