login08 Posted November 4, 2008 Report Share Posted November 4, 2008 <form action="" method="post"> <input type="checkbox" name="name" value="varible" /><br /> <input type="checkbox" name="name" value="varible2" /><br /> <input type="checkbox" name="name" value="varible3" /><br /> <input type="submit" value="Saglabat" name="send"/> </form> <? if(isset($_POST['send'])){ $variable = $_POST["name"]; echo "$variable"; } ?> Nevaru panakt, kad iekeksejot vairakus checkbox izvada attiecigas vertibas. Link to comment Share on other sites More sharing options...
andrisp Posted November 4, 2008 Report Share Posted November 4, 2008 Tev čekbokšiem ir vienādi nosaukumi, tāpēc tie viens otru "pārraksta". Nomaini name="name" uz name="name[]". Šādi tev PHP skriptam tiks aizsūtīts masīvs. Un masīvu nevar vienkārši drukāt ar echo. Tam vajag ciklēt cauri (piem., ar foreach) un katru vērtību atsevišķi izdrukāt. Debugošana gan vari izmantot print_r() vai var_dump(). Tie izdrukā masīva saturu. PS. echo "$variable"; <- no tām pēdiņām nav nekāda jēga. Link to comment Share on other sites More sharing options...
vacant Posted November 4, 2008 Report Share Posted November 4, 2008 <form action="" method="post"> <input type="checkbox" name="name[]" value="varible" /><br /> <input type="checkbox" name="name[]" value="varible2" /><br /> <input type="checkbox" name="name[]" value="varible3" /><br /> <input type="submit" value="Saglabat" name="send"/> </form> <? if(isset($_POST['send'])){ foreach ($_POST['name'] as $value){ echo $value; } } ?> Link to comment Share on other sites More sharing options...
login08 Posted November 4, 2008 Author Report Share Posted November 4, 2008 Maciities, maciities un velreiz maciities. PALDIES! Link to comment Share on other sites More sharing options...
Java Posted November 6, 2008 Report Share Posted November 6, 2008 Maciities, maciities un velreiz maciities. PALDIES! Teica Vasīlijs no Ļeņigradas. Link to comment Share on other sites More sharing options...
Recommended Posts