fantomel Posted March 25, 2009 Share Posted March 25, 2009 Hello i'm having some problems with testing a code for a friend. It doesn't give any error can someone test the code.. and maybe tell me where is the mistake .. cuz in eclipse it doesn't show any error. pula.php <? session_start(); ?> <form action="do_pula.php" method="post" enctype="application/x-www-form-urlencoded"> nume : <input name="dta[nume]" type="text" id="dta[nume]" value="<?=$_SESSION[dta][nume];?>" /> <? if (in_array('nume', $_SESSION['err'])) {?> <div style="color:#F00">Numele este mai scurt de 3 litere!</div><? } ?> <br /> <br /> nr tel : <input name="dta[tel]" type="text" id="dta[tel]" value="<?=$_SESSION[dta][tel];?>" /> <? if (in_array('tel', $_SESSION['err'])) {?> <div style="color:#F00">Nr de tel nu este numeric!</div><? } ?> <br /> <br /> <input name="test" type="submit" value="test" id="test" /> </form> do_pula.php <? session_start(); $err=array(); foreach ($_POST[dta] as $k => $v) { switch($k) { case "nume": if (strlen($v) <= 3) $err[]=$k; break; case "tel": if (!is_numeric($v)) $err[]=$k; break; } } if (!count($err)) echo "Totul validat! <br /> Urmeaza inserarea in mysql .."; if (count($err)) { $_SESSION[dta]=$_POST[dta]; $_SESSION[err]=$err; header("Location: pula.php"); exit; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/ Share on other sites More sharing options...
lonewolf217 Posted March 25, 2009 Share Posted March 25, 2009 for starters you should always use <?php ?> instead of <? ?> beyond that, without any errors there isn't much to look at. make sure you have error reporting configured Quote Link to comment https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/#findComment-794006 Share on other sites More sharing options...
AdRock Posted March 25, 2009 Share Posted March 25, 2009 $_SESSION[dta]=$_POST[dta]; should be like $_SESSION['dta']=$_POST['dta']; for all session and post variables Quote Link to comment https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/#findComment-794008 Share on other sites More sharing options...
Maq Posted March 25, 2009 Share Posted March 25, 2009 Hello i'm having some problems with testing a code for a friend. It doesn't give any error can someone test the code.. and maybe tell me where is the mistake .. cuz in eclipse it doesn't show any error. It won't show any errors, it's just an editor, it will show errors in the browser. Before I examine your code, put this at the top of your page and tell me if you see any errors (in the browser...): ini_set ("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/#findComment-794012 Share on other sites More sharing options...
fantomel Posted March 25, 2009 Author Share Posted March 25, 2009 it doesn't show any error in the fields it shows the value... but with error_reporting nothing. Quote Link to comment https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/#findComment-794017 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.