how can I get the average of three grades from a student? [closed]

-1

I just need to take the student's average data is in a MYSQL database the page is made in php, how could you average the cells (grades) in an average cell? in this code as I am running the average. But I do not get anything out

<B>PROMEDIO:
          <input type='text' name='promedio' value="<?php echo @$promedio->promedio?>">
          <br>         


          <?
             @$gramatica = $_POST['gramatica'];
             @$matematicas = $_POST['matematicas'];
             @$historia = $_POST['historia'];

             @$promedio = ($gramatica + $matematicas + $historia)/3;


          ?>

    
asked by Arbol Jorge Villalvazo 17.09.2018 в 20:35
source

1 answer

1

I think the problem is that you first print the variable $ average empty and then do the calculation. You should do the calculation above the label.

<?
                 @$gramatica = $_POST['gramatica'];
                 @$matematicas = $_POST['matematicas'];
                 @$historia = $_POST['historia'];

                 @$promedio = ($gramatica + $matematicas + $historia)/3;


              ?>
    <B>PROMEDIO:
              <input type='text' name='promedio' value="<?php echo @$promedio?>">
              <br> 
    
answered by 18.09.2018 в 09:08