You are here: Re: Whats wrong with this code? « PHP Programming Language « IT news, forums, messages
Re: Whats wrong with this code?

Posted by Pedro Graca on 10/05/06 20:17

Garry Jones wrote:
> $antroj=0;
> $dtctxsz1 = $_POST["dtctxsz1"];
> if($dtctxsz1 == 0){
> print $dtctxsz1;
> $antroj = $antroj + 1;
> }
>
> It adds 1 to $antroj even when the value of $dtctxsz1 is not 0. I have
> spent 7 hours on this one problem. Its driving me nuts.

It works for me. Maybe some of the code you didn't post is the culprit.

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');

$antroj = 0;
$dtctxsz1 = '14'; // $_POST["dtctxsz1"];
if ($dtctxsz1 == 0) {
// print $dtctxsz1;
++$antroj;
}
echo 'after \'14\' $antroj is ', $antroj, ".\n<br>";

$dtctxsz1 = '0'; // $_POST["dtctxsz1"];
if ($dtctxsz1 == 0) {
// print $dtctxsz1;
++$antroj;
}
echo 'after \'0\' antroj is ', $antroj, ".\n<br>";

$dtctxsz1 = 'test'; // $_POST["dtctxsz1"];
if ($dtctxsz1 == 0) {
// print $dtctxsz1;
++$antroj;
}
echo 'after \'test\' $antroj is ', $antroj, ".\n<br>";

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация