reiniger Posted March 1, 2008 Report Posted March 1, 2008 Man ir vajadzigs viens Checkbox ar vērtībū vai nu atķeksēts vai arī nav... Kādam mainīgā tipam jābūt iekš MYSQL??? un ka to norealizet ar INSERT???
Ghenis Posted March 1, 2008 Report Posted March 1, 2008 (edited) tinyint(1) 1 apzīmē - jā 0 apzīmē - nē Insert INTO tabula (`field`) VALUES('1') Ja vēlies citus stāvokļus, ne tikai 1 vai 0, iesaku izmantot enum Edited March 1, 2008 by Ghenis
reiniger Posted March 1, 2008 Author Report Posted March 1, 2008 (edited) <input name="check" type="checkbox" value=""/> INSERT INTO tabula SET check='check'; man ir janorada pie input value??? Edited March 1, 2008 by reiniger
Ghenis Posted March 1, 2008 Report Posted March 1, 2008 padomā pats... 1 apzīmē - jā0 apzīmē - nē http://www.w3.org/TR/html4/interact/forms.html#checkbox http://www.w3.org/TR/html4/interact/forms....def-value-INPUT
reiniger Posted March 6, 2008 Author Report Posted March 6, 2008 (edited) Man janorada kadas vērtības ir Checkbox??? nevaru nekadi saprast... Insert INTO tabula (`field`) VALUES('1') ne jau vienmer man ir vajadziga vertiba 1 ... vajag ta ja neatzimets tad lai paliek 0... ka to darbut gatavu uzmetiem mazu piemerinju!!!! Edited March 6, 2008 by reiniger
reiniger Posted March 6, 2008 Author Report Posted March 6, 2008 (edited) Es laikam neprotu aprakstit savu problemu... Ja jau tad kad ir nospiest tad jainserto 1 bet tad kad nav nospiest tad 0 tas nozime ka man ar IF janosaka vai nospiests vai nav??? un no ta atkariba vai 1/0 tad divi dazadi insert??? Edited March 6, 2008 by reiniger
andrisp Posted March 6, 2008 Report Posted March 6, 2008 if (ir_nospiests) { $lala = 1; } else { $lala = 0; } Un tad izmanto to $lala iekš kverija. Un nevajag rakstīt piecdesmit jautājumu zīmes. Tā nav smuki.
Aleksejs Posted March 6, 2008 Report Posted March 6, 2008 Ja nav ieķeksēts tas čekboksis, tad tas vispār netiek aizsūtīts submitojot formu tādēļ: if(isset($_POST['checkboxis'])){ $check_value=1; } else { $check_value=0; } $vaicajums = 'INSERT INTO `Tabula` (`lauks`) VALUES ('. $check_value .')';
reiniger Posted March 6, 2008 Author Report Posted March 6, 2008 (edited) liels paldies... atrasu pats sev vienu kludu pie insert nebiju pielicis $check_value... Edited March 6, 2008 by reiniger
Recommended Posts