I want to do that when my checkbox is checked, some values (data) from my database will be displayed on my web page, but when i execute my code there two message appears on my web page "Warning: mysql_query() expects parameter 1 to be string, resource given in C:\xampp\htdocs\php\checkboxes.php on line 5 " and "Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\php\checkboxes.php on line 10". I almost try everything to fix this but i failed to, so i'm comming here to ask you for some help.
There is my code :
test.php :
<form action="checkboxes.php" method="post">
<input type="checkbox" name="checkbox1" value="Yes" />
<input type="submit" name="formSubmit" value="Submit" />
</form>
config.php :
<?php
/* Database connection */
$sDbHost = 'localhost';
$sDbName = 'testowanie';
$sDbUser = 'root';
$sDbPwd = '';
$dbcon = mysql_connect ($sDbHost, $sDbUser, $sDbPwd, $sDbName);
?>
checkboxes.php:
<?php
include('config.php');
$sqlget = "SELECT * FROM monitory";
$sqldata = mysql_query($dbcon, $sqlget);
if(isset($_POST['checkbox1']) &&
$_POST['checkbox1'] == 'Yes')
{
while($row = mysql_fetch_array($sqldata, MYSQL_ASSOC)) {
echo $row['cena'];
}
}
?>