Jump to content

form text box help


deathstrike369

Recommended Posts

I have a form that i need to show certain calculation on a form.

these are the calculations, the form is to long but i will add the code that relate to where i need to add the calculations.

the problem i have is that nothing shows up.

<br />
Your attack Bonus is: <input type="text" name="attbonnum" readonly="readonly" value="<?php echo $_POST['attwith'] ?>" /> 
<br />
Your enemies fighter count is: <input type="text" name="Fighternum" readonly="readonly" value="<?php echo $_POST['number'] ?>" />
<br /> 
You need to send: <input type="text" readonly="readonly" name="sendammount" value="<?php echo $_POST['sendammount'] ?>" /><br />

 

$sector= $_POST ["AttackingSector"];
            $council= $_POST ["AttackingCouncil"];
            $playtype= $_POST ["attpt"];
            $system= $_POST ["psatt"];
            $titan= $_POST ["atttitan"];
            $bot= $_POST ["bot"];
            $power= $_POST ["zeorpower"];
            $attalert= $_POST ["alert"];
            $attres= $_POST ["attres"];
            $oversend= $_POST ["oversend"];
            $bonus= ($sector * $council * $playtype * $system * $titan * $bot * $power * $attalert * $attres);


            $defsec= $_POST ["defensivesector"];
            $defcouncil= $_POST["DefensiveCouncil"];
            $defpt= $_POST ["defpt"];
            $defsystem= $_POST ["psdef"];
            $deftitan= $_POST ["deftitan"];
            $defalert= $_POST ["defalert"];
            $defres= $_POST ["defres"];
            $defbonus= ($defsec * $defcouncil * $defpt * $defsystem * $deftitan*$defalert * $defres * $oversend); 
		if($bonus == 0){
			$bonus =1;}
			if($defbonus == 0){
				$defbonus = 1;}

            $attwith= $bonus / $defbonus;
            

		$python= $_POST ["python"];
            $lance= $_POST ["lance"];
            $pheonix= $_POST ["phenix"];
            $tweet= $_POST ["tweet"];
            $superator= $_POST ["super"];
            $indie= $_POST ["indie"];
            $turret= $_POST ["turrets"];
            $ship= $_POST ["fightertype"];
		$shipp= $python * 10;
		$shipl= $lance * 2;
		$shipP = $pheonix * 5;
		$shipt= $tweet * 4;
		$ships= $superator * 11;
		$shipi= $indie * 20;
		$shiptu= ($turret * 6);

		$shipcountotal= ($shipp + $shipl + $shipP + $shipt + $ships + $shipi + $shiptu);
		if ($shipcountotal == 0)
		{$shipcountotal = 1;}
		if($ship == 0){
			$ship = 1;}



		$number= $shipcountotal / $ship;








            


           $sendammount = ceil($number / $attwith);
         

?>

Link to comment
Share on other sites

the code has a lot of values, i tried to keep it short....

 

 

 

<form action="att.php" name="fighters" method="post"  >
<p> 
    AH-64 Apache:<input name="python" type="text" value="<?php echo htmlentities($_POST['python']) ?>" />
    <br />
     UH-60 Blackhawk:<input name="lance" type="text" value="<?php echo htmlentities($_POST['lance']) ?>"/>
    <br />
    F-14 Tomcat:<input name="phenix" type="text" value="<?php echo htmlentities($_POST['phenix']) ?>"/>
    <br />
    F-18 Hornet:<input name="tweet" type="text" value="<?php echo htmlentities($_POST['tweet']) ?>" />
    <br />
    F-15E Strike Eagle:<input name="super" type="text" value="<?php echo htmlentities($_POST['super']) ?>" />
    <br />
    FA-22 Raptor:<input name="indie" type="text" value="<?php echo htmlentities($_POST['indie']) ?>" />
    <br />
    Turrets: <input name="turrets" type="text" value="<?php echo htmlentities($_POST['turrets']) ?>" />
    <br />
    Upgrade? <input name="upgrade" type="checkbox" value="1.34" />
  </p>

    <br />
   <strong>Bonuses</strong>
   <p>Defending player</p>
   Player Type:
   <select name="defpt">
        <option value=".9">attacker</option>
         <option value=".9">Economist</option>
          <option value="1.15">Miner</option>
           <option value="1.5">Explorer</option>
            <option value="1">Standard</option>
             <option value="1.1">Researcher</option>
    </select>
    <br />
   Council: <select name="DefensiveCouncil">
                 <option value="1.2">System Commander</option>
                  <option value="1.15">Vice System Commander</option>
                   <option value="1.15">Fleet Admiral</option>
                    <option value="1.12">Vice Fleet Admiral</option>
                     <option value="1">Starship Fleet Leader</option>
                      <option value="1.12">Fighter squadron leader</option>
                       <option value="1">Intelligence Officer</option>
                        <option value="1">Secretary of treasury</option>
                         <option value="1">Nooby Advisor</option>
                       
   </select>
   <br />  
   Sector Bonus:
   <select name="defensivesector">
        <option value="1.1">Sector Leader</option>
         <option value="1.05">Vice Sector Leader</option>
          <option value="1">None</option>
   </select>
   <br />
   Private system with defensive bonus?
   <select name="psdef">
       <option value="1">No</option>
        <option value="1.2">Yes</option>
   </select>
   <br />
   Research:
        <select name="defres">
           <option value="1">namele(none)</option>
            <option value="1.02">Lasers mark I</option> 
             <option value="1.04">Lasers mark II</option> 
              <option value="1.06">Lasers mark III</option> 
               <option value="1.08">Lasers mark IV</option> 
                <option value="1.1">Lasers mark V</option> 
                 <option value="1.2">Dual Lasers</option> 

        
        </select>
<br />
   Titan (experimental)
   <select name="deftitan">
        <option value="1.12">Yes</option>
         <option value="1">No</option>
          <option value="1.12">Dont know, assume yes</option>
   </select>
   <br />
   
   
   Alert status:
    <select name="defalert">
        <option value="1.1">red</option>
         <option value="1.02">orange</option>
          <option value="1">yellow</option>
           <option value=".95">green</option>
        
    </select>
    
    <br />
    Is this a bot?
    <select name="bot">
        <option value="1">No</option>
         <option value="2">yes</option>
    </select>
   
    <p>Attacking player</p>
    player: <select name="attpt">
        <option value="1.5">attacker</option>
         <option value=".9">Economist</option>
          <option value="1">Miner</option>
           <option value=".5">Explorer</option>
            <option value="1">Standard</option>
             <option value="1">Researcher</option>
    </select>
    <br />
    Council:
    <select name="AttackingCouncil">
                 <option value="1.2">System Commander</option>
                  <option value="1.15">Vice System Commander</option>
                   <option value="1.15">Fleet Admiral</option>
                    <option value="1.12">Vice Fleet Admiral</option>
                     <option value="1">Starship Fleet Leader</option>
                      <option value="1.12">Fighter squadron leader</option>
                       <option value="1">Intelligence Officer</option>
                        <option value="1">Secretary of treasury</option>
                         <option value="1">Nooby Advisor</option>
                       
   </select>
   <br />
   Sector Bonus:
   <select name="AttackingSector">
        <option value="1.1">Sector Leader</option>
         <option value="1.05">Vice Sector Leader</option>
            <option value="1">None</option>
   </select>
   <br />
   Private system with attack bonus?
   <select name="psatt">
        <option value="1">No</option>
         <option value="1.6">Yes</option>
   </select>
   <br />
   Research:
        <select name="attres">
           <option value="1">(none)</option>
            <option value="1.02">Torpedoes mark I</option> 
             <option value="1.04">Torpedoes mark II</option> 
              <option value="1.06">Torpedoes mark III</option> 
               <option value="1.08">Torpedoes mark IV</option> 
                <option value="1.1">Torpedoes mark V</option> 
                 <option value="1.2">Photon Torpedoes </option> 

        
        </select>
<br />
   Titan(experimental)
   <select name="atttitan">
        <option value="1.12">Yes</option>
         <option value="1">No</option>
            <option value="1.12">Dont know, assume yes</option>
   </select>
   
   
  
  Attacking with?
   <select name="fightertype">
        <option value="20">FA-22 Raptor</option>
        <option value="11">F-15E Strike Eagle</option>
        <option value="4">F-18 Hornet</option>
        <option value="10">F-14 Tomcat</option>
        <option value="2">UH-60 Blackhawk</option>
        <option value="5">AH-64 Apache</option>
    </select>
    
    <br />
    
    Zero power?
    <select name="zeorpower">
        <option value="1">No</option>
        <option value="1.8" >Yes</option>
    </select>
    
    <br />
    Alert status:
    <select name="alert">
        <option value="1.1">red</option>
        <option value="1.02">orange</option>
        <option value="1">yellow</option>
        <option value=".95">green</option>
    </select>
    <br />
    Oversend:
    <select name="oversend">
    <option value="1.1">10%</option>
    <option value="1.05">5%</option>
    <option value="1">NONE</option>
    </select>
  
  <input type="submit" name="attackbonusnumber" value="calculate bonus" />
<br />
Your attack Bonus is: <input type="text" name="attbonnum" readonly="readonly" value="<?php echo $_POST['attwith'] ?>" /> 
<br />
Your enemies fighter count is: <input type="text" name="Fighternum" readonly="readonly" value="<?php echo $_POST['number'] ?>" />
<br /> 
You need to send: <input type="text" readonly="readonly" name="sendammount" value="<?php echo $_POST['sendammount'] ?>" /><br />
<br />


<input type='text' readonly='readonly' name="tydeath" />
<br />

</form>
<table border=2>
    <tr>
        <td><a href="Homecalc.htm">Homes</a></td>
        <td><a href="pkcal.htm">PkCalc</a></td>
        <td><a href="sscalc.htm">Starship Calc</a></td>
        <td><a href="attcalc.htm">Fighter Calc</a></td>
    </tr>
</table>
</body>
</html>
</php>

 

the main jist of this is that i am converting from html to php, for security and for reliability

on html it works perfectly (the formulas and values) but from the testing and debugging ive done on the php code it does not seem to be accepting the submit

Link to comment
Share on other sites

I'm still not completely understanding your question. Where's the PHP to go along with that?

 

Also, I'm not sure what you're trying to do here:

 

</php>

 

edit: Hm.. I think I might get it now. But still, you're never echoing out the result of your calculation anywhere that I can see.

Link to comment
Share on other sites

You need to send: <input type="text" readonly="readonly" name="sendammount" value="<?php echo $_POST['sendammount'] ?>" /><br />

 

this is where the result is supposed to be posted into

 

im gonna get some sleep and give it another go in the morning with fresh eyes, if you can help with this, then i would appreciate it very much

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.