Oops, I have a problem and I can not find a solution, it can be simple, but I'm not filling the error. If you can help me thank you! Next, I made a script where I can get the PRICE of the "PRODUCTS" TABLE and add to an input, the PRICE of the product is added normally, however when clicking on the submit is shown the error Undefined index price. I'll show the code just below.
This is my HTML, where I select the product and the corresponding value.
<select name="nome" class="form-control" id="produto" >
<option>Selecione o produto do pedido </option>
<?php
include_once 'banco.php';
$pdo = Banco::conectar();
$sql = 'SELECT * FROM products ORDER BY id DESC';
foreach($pdo->query($sql)as $row){
echo '<tr>';
echo '<option class="valores" data-valor="'.$row['preco'].'">'.$row['nome'].'</option>';
echo '</tr>';
}
echo '</select><br>';
?>
<div class="form-group">
<label class="preco">Preço do produto</label><br>
<div class="col-sm-10">
<input type="text" id="valor" name="valor" disabled="disabled" class="form-control select2" style="width: 30%;" placeholder=" 00">
Here's the error !!
Notice: Undefined index: valor in /opt/lampp/htdocs/orquidariaVersion1.0.1/pages/adm/register_pedidos.php on line 112
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'valor' cannot be null