I have a problem with my code, I wanted to do that when I click on a checkbox and then on the acceptation button a sql statement will be executed.
There is my code:
<form action="checkboxes.php" method="post">
<input type="checkbox" value="dawid" name="chk1"> 4K </input>
<input type="submit" name="Submit" value="Submit"></input>
</form>
<?php
/* Database connection */
$sDbHost = 'localhost';
$sDbName = 'testowanie';
$sDbUser = 'root';
$sDbPwd = '';
$Conn = mysql_connect ($sDbHost, $sDbUser, $sDbPwd);
mysql_select_db ($sDbName, $Conn)
$checkbox1 = $_POST['chk1'];
if ($_POST["Submit"]=="Submit") {
for ($i=0; $i<sizeof($checkbox1); $i++) {
$query=SELECT * FROM monitory WHERE cena=1000;
mysql_query($query) or die (mysql_error() );
}
echo "This work";
}
?>
But it don't work and when i click on the submit button a text appears "Parse error: syntax error, unexpected 'monitory' (T_STRING)" from 5hours i'am trying to fix that but i don't know how. If someone can help me it will be great.
Aucun commentaire:
Enregistrer un commentaire