Jump to content

test some code maybe find the problem


fantomel

Recommended Posts

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;
}
?>

Link to comment
https://forums.phpfreaks.com/topic/151147-test-some-code-maybe-find-the-problem/
Share on other sites

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);

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.