-2
I have a code that sends some information but it’s not sending the full copies I don’t know why. I send everything else up to the file except the total copies. I used an echo="$totalcopias" instead the value of the variable and the value ta la but when I try to send it is undifined index.
    $mailto = $_POST['mailto'];
    $mailSub = $_POST['mailsub'];
    $escola=$_POST['escola']; 
    $nome = $_POST['nome'];
    $processo=$_POST['processo']; 
    $disciplina=$_POST['disciplina']; 
    $a4cor = $_POST['a4cor'];
    $a4preto = $_POST['a4preto'];
    $a3cor=$_POST['a3cor'];
    $a3preto=$_POST['a3preto'];
    $impressao=$_POST['impressao'];  
    $observacoes=$_POST['observacoes'];
    $totalcopias=$a4cor + $a4preto + $a3cor + $a3preto;
    $target = "ficheiros/".basename($_FILES['ficheiro']['name']);
$mail ->Body='<h2>Escola: '.$_POST['escola'].'<br>Nome: '.$_POST['nome'].'<br>Processo: '.$_POST['processo'].'<br>Email: '.$_POST['email'].'<br>Disciplina: '.$_POST['disciplina'].'<br>Fotocópias A4 a cor: '.$_POST['a4cor'].'<br>Fotocópias A4 a preto: '.$_POST['a4preto'].'<br>Fotocópias A3 a cor: '.$_POST['a3cor'].'<br>Fotocópias A3 a preto: '.$_POST['a3preto'].'<br>Impressão: '.$_POST['impressao'].'<br>Observacões: '.$_POST['observacoes'].'<br>Total de fotocópias: '.$_POST['totalcopias'].'</h2>';
Check if in your form it contains this name
– gabrielfalieri
$totalcopiasis a variable, does not exist in the superglobal$_POST['totalcopias']. In fact, none of the variables you defined you used afterwards, which made no sense at all.– Woss
I have an input with value 0
– AvicT
These variables are only for sending because I send to the email and to a database
– AvicT
declares $valuables = 0; before
– gabrielfalieri