2017-11-13 4 views
-2

私の情報がPOST配列に正しく配置されていないようです。私はPHPに新しいので、私はあまり理由がわからない。私はこれに必要な情報が他に何であるかわからないので、コードとエラーメッセージを置くだけです。あなたが提供できるどんな助け/アドバイスも大歓迎です。PHPでのフォーム提出時のエラー

これはレンダリングされた後のフォームです。 enter image description here

これは送信後に表示されるエラーです。

The error I get after I select submit

ここでコードスニペットです。私はすべてのhtmlを含めていない。私はPHPを捨てて、Javaのものを書く必要があるかもしれません。意見が歓迎された。

 <h2 class="tgminix-padding-large" style="margin:auto;max-width:1000px">Calculating Total Percent Impedance Upstream of the Motor</h2> 
    <hr class="tgminix-border-grey" style="margin:auto;width:80%"> 
    <p><span class="error">* Required Field</span></p> 
    <form method="post" action="<?php echo htmlspecialcharachars($_SERVER["PHP_SELF"]);?> 
      High Side Busbar Impedance (Real): <input type="float" name="SubstationHighsideEqivImpedanceR"> 
      <span class="error"> <?php echo $subImpedanceError;?></span> 
      <br><br> 
      High Side Busbar Impedance (Imaginary): <input type="float" name="SubstationHighsideEqivImpedanceI"> 
      <span class="error"> <?php echo $subImpedanceError;?></span> 
      <br><br> 
      Low Side Busbar Impedance (Real): <input type="float" name="SubstationLowsideEquivImpedanceR"> 
      <span class="error"><?php echo $subImpedanceError;?></span> 
      <br><br> 
      Low Side Busbar Impedance (Imaginary): <input type="float" name="SubstationLowsideEquivImpedanceI"> 
      <span class="error"><?php echo $subImpedanceError;?></span> 
      <br><br> 
      Motor Starting Power Factor: <input type="float" name="MotorStartingPowerFactor_num"> 
      <span class="error"><?php echo $subImpedanceError;?></span> 
      <br><br> 
      <input type="submit" value="Submit"> 
    </form> 
    <?php 
    /* Locked Rotor Constants Array 
    $MotorLockedRotorConstants = array(
      array("NEMA Code Letter","Mid-Value Constant") 
      array("A",1.6) 
      array("B",3.3) 
      array("C",3.8) 
      array("D",4.3) 
      array("E",4.7) 
      array("F",5.3) 
      array("G",5.9) 
      array("H",6.7) 
      array("J",7.5) 
      array("K",8.5) 
      array("L",9.5) 
      array("M",10.6) 
      array("N",11.8) 
      array("P",13.2) 
      array("R",15.0) 
      array("S",17.1) 
      array("T",19.0) 
      array("U",21.5) 
      array("V",25));*/ 
     if ($_POST){ 
      $SubstationHighsideEqivImpedance_real = $_POST["SubstationHighsideEqivImpedanceR"]; 
      $SubstationHighsideEquivImpedance_imaginary = $_POST["SubstationHighsideEqivImpedanceI"]; 
      $SubstationLowsideEquivImpedance_real = $_POST["SubstationLowsideEquivImpedanceR"]; 
      $SubstationLowsideEquivImpedance_imaginary = $_POST["SubstationLowsideEquivImpedanceI"]; 

      $MotorStartingPowerFactor = $_POST["MotorStartingPowerFactor_num"]; 

      $SubstationPercentImpedance = ""; 
      $TEMP_X_perc = $TEMP_R_perc = ""; 
      $TEMP_X_perc = $SubstationLowsideEquivImpedance_imaginary + 0.333333 * $SubstationHighsideEquivImpedance_imaginary; 
      $TEMP_R_perc = $SubstationLowsideEquivImpedance_real + 0.33333 * $SubstationHighsideEqivImpedance_real; 
      $RAD_ANGLE_TEMP = $MotorStartingPowerFactor*(pi()/180); 
      $DEG_ANGLE_TEMP_cos = (180/pi()) * cos($RAD_ANGLE_TEMP); 
      $DEG_ANGLE_TEMP_sin = (180/pi()) * sin($RAD_ANGLE_TEMP); 
      $SubstationHisideImpedancePercent = ($TEMP_R_perc * $DEG_ANGLE_TEMP_cos) + ($TEMP_X_perc * DEG_ANGLE_TEMP_sin); 
     } else { 
      echo "There's nothing in POST. srry" 
     } 
     ?> 
    <p class="tgminix-padding-large" style="margin:auto;max-width:1000px"> 
     The Substation Impedance is: <?php echo $SubstationHisideImpedancePercent; ?> 
     <br> 
     The Substation Impedance is: <?php echo $TEMP_R_perc; ?> $ + \mathbf{i}$ <?php echo $TEMP_X_perc; ?> 
    </p> 

これがあまりにもあいまいである場合はお知らせください。

+0

'htmlspecialcharachars()' PHP関数ではない、それは[ 'はhtmlspecialchars()'](http://php.net/manual/en/function.htmlspecialchars.php)であるべきです。また、あなたの 'form'タグに閉じ引用と括弧がありません - '

" > ' – WOUNDEDStevenJones

答えて

0
REPLACE 
    <form method="post" action="<?php echo htmlspecialcharachars($_SERVER["PHP_SELF"]);?> 
    WITH 
    <form method="post" action="<?php echo htmlspecialcharachars($_SERVER["PHP_SELF"]);?>"> 
+0

親切に、試してみてください。ありがとう。 –

関連する問題