i'm trying to create a php web app that will have options to select using checkbox form and then submit the checkedbox to other file. but how can i do this if the value of checkbox is defined with values from query? please help me, i cant find a solution :/
<form action="addPratosEnc4.php" method="POST">
*Pratos a Adicionar:
<select name="nomeA">
<?php
try
{
$host = "xxxx";
$user ="xxx";
$password = "xxx";
$dbname = $user;
$db = new PDO("mysql:host=$host;dbname=$dbname", $user, $password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = "SELECT nomeA FROM Disponivel;";
$result = $db->query($sql);
foreach($result as $row)
{
$nomeA = $row['nomeA'];
/*should be here?*/
}
$db = null;
}
catch (PDOException $e)
{
echo("<p>ERROR: {$e->getMessage()}</p>");
}
?>
</select>
<br>
<br>
<input type="submit" value="Disponibilizar">
</form>