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

Posted by Garry Jones on 10/05/06 20:06

<halkeye@gmail.com> skrev i meddelandet
news:1160075930.560400.315630@e3g2000cwe.googlegroups.com...
> Off the top of my head, since you don't say what $dtctxsz1 is. I'd say
> its because $dtctxsz1 is blank or null, which "== 0" returns true for.

Here is some more of the offending code.

First - Exerpt from a form.

<select name="dtctxsz1" class="vtredstar" id="dtctxsz1">
<option value="0" selected>Ej vald</option>
<option value="xs">XS</option>
<option value="s">S</option>
<option value="m">M</option>
<option value="l" >L</option>
<option value="xl">XL</option>
<option value="xxl">XXL</option>
<option value="xxxl">XXXL</option>
</select>

Processed by.....

$antroj = 0;
$dtctxsz1 = $_POST["dtctxsz1"];
if($dtctxsz1 == 0){
print $dtctxsz1;
$antroj = $antroj + 1;
}

If the user chooses xl the value of $dtctxsz1 is xl.

It should not then execute the print command because $dtctxsz1 is not 0.

However it prints, and it prints the value the user clicked on - in this
case xl

It should not be adding one to the value of $antroj should it. But it is!

If the value was misfiring it would be printing 0 because it can only print
when the value is 0. So I am missing something here!

Greatful for any help in this matter.

Garry Jones
Sweden

 

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

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