1
Every time I click the send button, I receive the email with the right data, but after sending, I receive on the page an error message: PHP Notice: Undefined index: modulocomercial in E:\Domains\diretivagestao.com\wwwroot\website\pageswebsite\enviar_orcamento.php on line 4
That is, whenever I do not check some checkbox from the list and submit, it gives error by I did not have it filled, but how do I remove this error and choose any combination of checkbox for sending without error?
<div class="campo">
<label>Interesse(s):</label>
<label>
<input type="checkbox" name="modulocomercial" value="comercial" /> Módulo Comercial
</label>
<label>
<input type="checkbox" name="moduloindustria" value="industria" /> Módulo Indústria
</label>
<label>
<input type="checkbox" name="modulovendas" value="vendas" /> Módulo Vendas
</label>
<label>
<input type="checkbox" name="modulooficina" value="oficina" /> Módulo Oficina
</label>
<label>
<input type="checkbox" name="modulofinanceiro" value="financeiro" /> Módulo Financeiro
</label>
<label>
<input type="checkbox" name="modulocontabil" value="contabil" /> Módulo Contábil
</label>
<label>
<input type="checkbox" name="modulograos" value="graos" /> Módulo Grãos
</label>
<label>
<input type="checkbox" name="modulofiscal" value="fiscal" /> Módulo Fiscal
</label>
<label>
<input type="checkbox" name="modulocombustiveis" value="combustiveis" /> Módulo Combustíveis
</label>
<label>
<input type="checkbox" name="modulotodos" value="todos" /> Todos
</label>
</div>
Shipping form:
<?
$modulecomercial = $_POST['modulocomercial']; //pega os dados que foi digitado no ID modulo.
$moduleindustria = $_POST['moduloindustria'];
$modulevendas = $_POST['modulovendas'];
$moduleoficina = $_POST['modulooficina'];
$modulefinanceiro = $_POST['modulofinanceiro'];
$modulecontabil = $_POST['modulocontabil'];
$modulegraos = $_POST['modulograos'];
$modulefiscal = $_POST['modulofiscal'];
$modulecombustiveis = $_POST['modulocombustiveis'];
$moduletodos = $_POST['modulotodos'];
$corpo = "Este é um contato enviado pelo site com as seguintes informações sobre os modulos:\n\n\n";
$corpo .= "Módulo(s): " . $modulecomercial . ", " . $moduleindustria . ", " . $modulevendas . ", " . $moduleoficina . ", " . $modulefinanceiro . ", " . $modulecontabil . ", " . $modulegraos . ", " . $modulefiscal . ", " . $modulecombustiveis . ", " . $moduletodos . "\n";
$email_to = '[email protected]';
?>
If you do not mark any value is sent to php. In this my suggestions are to exchange all checkboxes for selects where the default value is
não
. Or leave the checkbox as an array. Instead of picking it individually will use a foreach.– rray
Grateful for the contribution, but I did not understand what you said, I am beginner in php, I was already happy that my email is being sent hehehehe, some simple way to remove this error friend?
– weise