I have an html form, with some checkbox.
I want to write an sql to include my checkbox.
For example on my Database:
Column: Stato
Options: 0,1,2,3
Where:
- 0 = Aperto,
- 1 = Stampato,
- 2 = Bloccato,
- 3 = ❤ (Favorite),
So, if they are all selected you must show me all kinds, otherwise not.
How can I write sql?
This is my checkbox:
<div id="radioset">
<input type="checkbox" id="radio1" name="aperto" checked="checked"><label for="radio1">Aperto</label>
<input type="checkbox" id="radio2" name="stampato" checked="checked"><label for="radio2">Stampato</label>
<input type="checkbox" id="radio3" name="bloccato" checked="checked"><label for="radio3">Bloccato</label>
<input type="checkbox" id="radio4" name="favorite" checked="checked"><label for="radio4">♥</label>
</div>
And this is my PHP sql:
$input=$_POST['input'];
$id=$_POST['id'];
$tipo=$_POST['tipo'];
$numero1=$_POST['numero1'];
$numero2=$_POST['numero2'];
$data1=date('d/m/Y', strtotime($_POST['from']));;
$data2=date('d/m/Y', strtotime($_POST['to']));;
$sql="SELECT [Id Ord] AS [ID], [Tipo Ord] AS [Tipo], [N Ord] AS [Numero], [Data Ord] AS [Data], [Ragione Sociale], [Indirizzo], [TotImp] AS [IMPORTO TOTALE], [TotIva] AS [IMPORTO IVA] FROM [Ordini] WHERE [Id Ord] LIKE '$id' OR [Tipo Ord] LIKE '$tipo' OR [Data Ord] BETWEEN #$data1# AND #$data2#";
$rs = $con->execute($sql);
Thanks!
Aucun commentaire:
Enregistrer un commentaire