what's wrong with this if statement?

[php]<?php
$w=’ ';
if(isset($_POST[‘word’])and $_POST[‘word’]==‘q’)
{
$w=‘w1’;
}
else {
$w=‘w2’;
}
?>[/php]


when I type 'q' into input the form's action remains "w2". Can you help me, please? yours` serguey

Are errors on? I reckon you should be getting an error in the statement. You could try changing ‘and’ to &&

errors are on.
&& has been tried before I asked for help

besides, I tried to replace “=” with “==” like following`
[php]$w==‘w1’; …$w==‘w2’;[/php]
and the script stopped to open even w2.

What errors did you recieve?

And yes that would halt the code. == is a comparison. = is setting.

you are right the ‘==’ leads nowhere in this here script.
it triggers no error messages just opens w2 in defience of php logic,
the idea was to let user choose a file/folder by typing in their wish.

Sponsor our Newsletter | Privacy Policy | Terms of Service