Klokjis Posted July 27, 2005 Report Share Posted July 27, 2005 nu lieta taada, ka vajag regjistraacijaa... izveeleeties datumus -> 26. vai 27. vai arii abi. vienkaarshi to visu izdariit ar checkbox. vienkaarshi atkjeksee kuros datumos... bet taalaak kaa lai no checkboxa izvada veertiibas, kad vinjsh ir iekjekseec, un kad nav... vajadzeetu taalaak taa lai vareetu to ieraxtiit MySQL db. normaali veel vareetu buut: ar "if", bet kaa?! jo jaapieljauj iespeeja ka nebuus iekjekseec neviens un ka buus iekjekseeti abi... <input type="checkbox" name="naktsmitnes" value="1"> 26... <input type="checkbox" name="naktsmitnes" value="2"> 27... Link to comment Share on other sites More sharing options...
v3rb0 Posted July 27, 2005 Report Share Posted July 27, 2005 chekboxam nevar likt value="1" value="2" nosutot formu uz serveri nosutas tikai iekeksetie ar vertibu "on" liec pie name klat vertibas <input type="checkbox" name="naktsmitnes_1" /> un servera pusee mekle vai sanjemi naktsmitnes_1. Link to comment Share on other sites More sharing options...
bubu Posted July 27, 2005 Report Share Posted July 27, 2005 v3rb0, kā tas ir nevar value=1 likt? Protams, ka var! Klokjis, ja neuztrauc īpaši standarti, tad sauc tos chekboxus name="blabla[]" visus. un tad php galā tev tas $_POST['blabla'] būs masīvs, kurā būs salikti tie value. Var arī kā v3rb0 saka, katram unikālu name, un tad pārbaudi katru atsevišķi. Link to comment Share on other sites More sharing options...
v3rb0 Posted July 27, 2005 Report Share Posted July 27, 2005 mūžu dzīvo mūžu mācies.. Link to comment Share on other sites More sharing options...
Klokjis Posted July 27, 2005 Author Report Share Posted July 27, 2005 nu ok ja es palieku pie 'naktsmitnes_1' un 'naktsmitnes_2' jo vairaak man vinji nav vajadziigi... tad kaa vinji tiek atshkjiroti... kad ir iekjekseec, kad nav? un iznaak ka taalaak var kaut kaa taa...: <? $naktsmitnes = $_POST['naktsmitnes']; if ($naktsmitnes_1 = $naktsmitnes_2 = '...' ) {$naktsmitnes = '26.datums un 27. datums';} elseif ($naktsmitnes_1 = '...') {$naktsmitnes = '26.datums';} elseif ($naktsmitnes_2 = '...') {$naktsmitnes = '27.datums';} else {$naktsmitnes = 'nav nepieciesamas'} ?> un ko tur pie '...' vajadzeetu likt? kjipa lai noraadiitu - iekjekseetc... ??? Link to comment Share on other sites More sharing options...
Kristabs Posted July 27, 2005 Report Share Posted July 27, 2005 elseif (isset($naktsmitnes_1)) Link to comment Share on other sites More sharing options...
bubu Posted July 27, 2005 Report Share Posted July 27, 2005 (edited) Nu tak, ja tev ir name naktsmitnes_1, tad pārbaudi $_POST['naktsmitnes_1'] utt nevis kautkādus globālus nedefinētus mainīgos izmanto ;) btw, cerams, ka tu zini atšķirību starp = un == izmantošanu if nosacījumā.. Edited July 27, 2005 by bubu Link to comment Share on other sites More sharing options...
Klokjis Posted July 27, 2005 Author Report Share Posted July 27, 2005 kjipa, Kristabs... taa domaaji...: <? $naktsmitnes = $_POST['naktsmitnes']; if (isset($naktsmitnes_1 == $naktsmitnes_2)) {$naktsmitnes = '26.datums un 27. datums';} elseif (isset($naktsmitnes_1)) {$naktsmitnes = '26.datums';} elseif (isset($naktsmitnes_2)) {$naktsmitnes = '27.datums';} else {$naktsmitnes = 'nav nepieciesamas'} ?> un peec bubu teiktaa iznaak veel shaadi uzlaboc: <? if (isset($_POST['naktsmitnes_1'] == $_POST['naktsmitnes_2'])) {$_POST['naktsmitnes']; = '26.datums un 27. datums';} elseif (isset($_POST['naktsmitnes_1'])) {$_POST['naktsmitnes']; = '26.datums';} elseif (isset($_POST['naktsmitnes_1'])) {$_POST['naktsmitnes']; = '27.datums';} else {$_POST['naktsmitnes']; = 'nav nepieciesamas'} ?> ?! Link to comment Share on other sites More sharing options...
bubu Posted July 27, 2005 Report Share Posted July 27, 2005 Tev tas otrais kods ir absolūti un galīgi nepareizs! Tak skaties, ko pats raksti: 2. rindiņā: if (isset($a==$b)) { ... } 3/4. rindiņā if (...) { $c; = $d } Neliekas, ka tur pārāk daudz sintaktisku kļūdu? Link to comment Share on other sites More sharing options...
v3rb0 Posted July 27, 2005 Report Share Posted July 27, 2005 nezinu kāpēc rakstu citu vietā, bet nu reku Link to comment Share on other sites More sharing options...
Klokjis Posted July 27, 2005 Author Report Share Posted July 27, 2005 tnx ;) Link to comment Share on other sites More sharing options...
Recommended Posts