shurix Posted December 25, 2008 Report Share Posted December 25, 2008 Tiko saskaros ar probleemu. Kad forma ieraksta 0 un tad ar vinju vajag vaikta darbibu piemeram IF ($_POST['aa'] == "0") { echo "tev ir 0"; } Vinsh kaut kaa to 0 neatpazist un neko neizvada. Link to comment Share on other sites More sharing options...
bubu Posted December 25, 2008 Report Share Posted December 25, 2008 Ja tev tur vajag atļaut ievadīt tikai skaitļus, tad pārvērt to $_POST['aa'] uz skaitli (nokāsto uz int) un salīdzini ar integeru 0, nevis stringu "0". Link to comment Share on other sites More sharing options...
indoom Posted December 25, 2008 Report Share Posted December 25, 2008 varbūt pirms tam post tiek pārbaudīts ar empty() ? Link to comment Share on other sites More sharing options...
shurix Posted December 25, 2008 Author Report Share Posted December 25, 2008 Kaut ka nemaaku. Man vajag ja mainigais ir 0 tad vinju parveido par -1. $punkti2 = $_POST['punkti2']; $punkti22 = intval('$punkti2'); IF ($punkti22 == intval('0')) { $punkti22 == intval('-1'); } Link to comment Share on other sites More sharing options...
Pentiums Posted December 25, 2008 Report Share Posted December 25, 2008 $punkti2 = $_POST['punkti2']; $punkti22 = intval($punkti2); if($punkti22 == intval(0)) { $punkti22 = intval(-1); } Link to comment Share on other sites More sharing options...
bubu Posted December 25, 2008 Report Share Posted December 25, 2008 Kautkāds ārprāts... $punkti2 = intval($_POST['punkti2']); if ($punkti2 == 0) { $punkti2 = -1; } Link to comment Share on other sites More sharing options...
Kavacky Posted December 25, 2008 Report Share Posted December 25, 2008 $punkti22 = intval('$punkti2'); Omfg. Nu loģiski, ka '$punkti2' nav nekāds dižais integers. Link to comment Share on other sites More sharing options...
Recommended Posts