neo Posted May 24, 2005 Report Share Posted May 24, 2005 Man ir forma ar kaadiem 20 checkboxiem kuru veertiibas attieciigi ir jaasaglabaa vienaa mainiigaa. Kaa to var izdariit lai nav jaaraksta ar roku visi tie checkboxu mainiigie? Link to comment Share on other sites More sharing options...
bubu Posted May 24, 2005 Report Share Posted May 24, 2005 nosauc chekboksus: box1, box2, box3, ..., box20. Un tad, piemēram, lai izvadītu tos uz ekrāna: for ($i=1; $i<=20; ++$i) { $tmp = 'box'.$i; echo $i . ' = ' . (isset($_POST[$$tmp]) ? $_POST[$$tmp] : 'none'); } Link to comment Share on other sites More sharing options...
neo Posted May 24, 2005 Author Report Share Posted May 24, 2005 Paldies, bet man liekas, ka tev kodaa ieviesussies neliela kluudina :) for ($i=1; $i<=20; ++$i) { $tmp = 'box'.$i; echo $i . ' = ' . (isset($_POST[$tmp]) ? $_POST[$tmp] : 'none'); } Link to comment Share on other sites More sharing options...
Grey_Wolf Posted May 24, 2005 Report Share Posted May 24, 2005 Vispaar uzreiz nepateikshu kaa, bet ir iespeejams saglabaat visu chekboksu veertiibas vienaa mainiigajaa- masiivaa :) apskaties kaa HTMLa vinji apvienojas grupaas un grupas nosaukums buus mainiigaa (masiiva nosaukums) - HTTP_POST_VARS['nosaukums', 'elements'] ja ir ieslegti 'globalji' vienalga naksies izmantot pilno pieeju ... ja aatrumaa atradiishu preciizaak tad iemetiishu (bet man skjiet ka bija jaameklee HTML un DHTML virzienaa ) P.S. to bubu: tavs ieteiktais variants protams ir labs, bet nevienmeer tas der :( Link to comment Share on other sites More sharing options...
bubu Posted May 24, 2005 Report Share Posted May 24, 2005 Paldies, bet man liekas, ka tev kodaa ieviesussies neliela kluudina smile.gifUi, tev taisnība, nevajg tur tos $$ :) Vispaar uzreiz nepateikshu kaa, bet ir iespeejams saglabaat visu chekboksu veertiibas vienaa mainiigajaa- masiivaa smile.gif <input type="checkbox" name="masivs[]" value="blabla" /> <input type="checkbox" name="masivs[]" value="blabla2" /> un tad ieks php būs pieejams $_POST['masivs'] kā masīvs. Link to comment Share on other sites More sharing options...
Recommended Posts