Skip to content

Instantly share code, notes, and snippets.

@asllanmaciel
Created August 14, 2021 17:11
Show Gist options
  • Save asllanmaciel/8a0809c64ae17cbcdcdbf7e505ffa62d to your computer and use it in GitHub Desktop.
Save asllanmaciel/8a0809c64ae17cbcdcdbf7e505ffa62d to your computer and use it in GitHub Desktop.
Script para contagem de notas
<?php
if($_POST){
$arr = (array) $_POST['sintomas'];
$count = 0;
foreach($arr as $key => $value){
//echo $key . '<>' . $value . '<br>';
$count = $count + explode('|',$value)[0];
}
echo 'TOTAL:'.$count . '<br>';
//Verificações apenas...
//echo '<br>-------------------<br>';
//$arr_implode = implode(',', (array) $_POST['sintomas']);
//var_dump($arr);
}
?>
<form method="post">
<div class="form-group ">
<label for="sintomas">Sintomas</label>
<div><label> <input name="sintomas[]" type="checkbox" value="7|Febre maior que 37,2º C" /> Febre maior que 37,2º C </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="2|Tosse" /> Tosse </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="2|Espirro e/ou Coriza" /> Espirro e/ou Coriza </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="2|Dor de garganta" /> Dor de garganta </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="1|Enjoo" /> Enjoo </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="3|Dificuldade de respirar" /> Dificuldade de respirar </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="5|Alteração do gosto (paladar)" /> Alteração do gosto (paladar) </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="5|Perda do cheiro (olfato)" /> Perda do cheiro (olfato) </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="2|Diarreia" /> Diarreia </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="4|Dor no corpo ou nas pernas" /> Dor no corpo ou nas pernas </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="1|Dor no peito" /> Dor no peito </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="5|Calafrio e/ou Sudorese" /> Calafrio e/ou Sudorese </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="0|Não apresentou nenhum dos sintomas anteriores" /> Não apresentou nenhum dos sintomas anteriores </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="2|Dor de cabeça" /> Dor de cabeça </label></div>
<div><label> <input name="sintomas[]" type="checkbox" value="Outro (especifique):" /> Outro (especifique): </label></div>
</div>
<button>Enviar</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment