Posted by Jeff North on 10/05/06 23:11
On Thu, 5 Oct 2006 22:06:57 +0200, in comp.lang.php "Garry Jones"
<garry.jones@morack.se>
<eg3ohc$le4$1@yggdrasil.glocalnet.net> wrote:
>| <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;
>| }
The select control returns a string value so you should change your
code to:
if($dtctxsz1 == "0"){
>| 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
>|
---------------------------------------------------------------
jnorthau@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
[Back to original message]
|