-3
Good morning, I have the following problem: I want to add the initial evaluation with the final evaluation and the result appear on the screen but always zero, where I am failing?
<th>
<div class="input-field col s12">
<input id="AvInicial" type="text" class="validate"
autocomplete="off" name="AvInicial">
<label for="avinicial"></label>
</div>
</th>
<th>
<div class="input-field col s12">
<input id="Meta" type="text" class="validate" autocomplete="off"
name="Meta">
<label for="meta"></label>
</div>
</th>
<th>
<div class="input-field col s12">
<input id="AvIntercalar" type="text" class="validate"
autocomplete="off" name="AvIntercalar">
<label for="avintercalar"></label>
</div>
</th>
<th>
<div class="input-field col s12">
<input id="AvFinal" type="text" class="validate" autocomplete="off"
name="AvFinal">
<label for="avfinal"></label>
</div>
</th>
<th>
<div class="input-field col s12">
<?
$a = $_GET['avinicial'];
$b = $_GET['avfinal'];
echo $a + $b;
?>
</div>
</th>
var_dump the variables $a and $b to ensure that both are populated and integer
– Otto
Give an echo separately in the variables to see if the values are coming.
– Diego Vieira
@Diegovieira Fiz as I said and really the values are not coming.
– Vilela Vilela
Are you sending this data by GET even? It wouldn’t be via POST?
– Kayo Bruno
@Kayobruno tried with POST and nothing gave, in research I saw that should be with GET
– Vilela Vilela
Friend do the following: echo '<pre>'; print_r( $_GET ); die; This will show all values within $_GET, and show us what "printou".
– Kayo Bruno
@Kayobruno was thinking and nothing appears. Ta always thinking and not the rest of the table shows.
– Vilela Vilela
of an intval($a) + intval($b)
– Marcos Brinner
checks if your div is not with display:None
– Marcos Brinner
I think you are giving error, but your php may be configured not to show. try replacing the following lines with. $a = isset($_GET['avinicial'])? $_GET['avinicial']:0; $b = isset($_GET['avfinal'])? $_GET['avfinal']:0;
– David Vinicius
@Marcosbrinner nothing has changed, thank you so much for your help anyway!
– Vilela Vilela
add these lines at the beginning of your code to see if there are any errors
– Marcos Brinner
ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(E_ALL);
– Marcos Brinner
Are you even sending these values via $_GET? Post your html code. full so we can help.
– David Vinicius
Dude the names of the fields are different from the names you are trying to catch via GET: Avinicial != avinicial
– Kayo Bruno
@Kayobruno I don’t need the Avintercalar for this sum is only the Avinicial and Avfinal
– Vilela Vilela
@DavidVinicius 
 $nrutente = $_POST['NrUtente'];
 echo $nrutente;

 $avinicial = $_POST['AvInicial'];
 $meta = $_POST['Meta'];
 $avintercalar = $_POST['AvIntercalar']; $avfinal = $_POST['Avfinal']; $datastart = $_POST['Datastart']; $enddate = $_POST['Enddate'];
– Vilela Vilela
@Vilelavilela ai you are receiving, what I think may be occurring is that you are not doing the form Submit, at least in the code that showed I have not seen any kind of Action that makes the Submit of this form.
– David Vinicius
@Diegovieira then as he advises to change the code so as to place a Ubmit?
– Vilela Vilela
first make sure the code is between the <form> (your code) </form> tags. You can put <button type="Submit">SEND</button>. by clicking this button it will send your form.
– David Vinicius
Besides the names of the fields are different, you didn’t give a Ubmit, just trying to add values that were not set. Gives a search in GET and POST form examples in PHP. This will help you a little.
– Kayo Bruno
well in that case you could just make some in javascript instead of php, it would be much faster
– Marcos Brinner