Hi Lab,

I normally use code of the following format, which I think is quite neat:

//Note that you do not need curely brackets in an "if" statement is there is
only one line
if ($_SERVER['REQUEST_METHOD'] == 'POST')
    $add  = $HTTP_POST_VARS['textbox'];

if ($add == 'Hello')
    do something

//It is however recommended that you do the following in order to ensure
that a user does not try to use malicious code in their input

if ($_SERVER['REQUEST_METHOD'] == 'POST')
    $add  = clean($HTTP_POST_VARS['textbox'], 20);;

if ($add == 'Hello')
    do something

where clean() is a function defined in an include as follows:

function clean($input, $maxlength)
{
$input = substr($input, 0, $maxlength);
$input = EscapeShellCmd($input);
return ($input);
}

Hope that helps.

Regards,
Andy



"Labunski" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello, I have only one simple question..
> I'm using this method to get the values from the text box:
>
>   if(isset($_POST["Submit"]) && $_POST["Submit"]=="Submit")
>  {
>    $add = $_POST['textbox'] ;
>  }
>
> But I don't know how to write the source for this:
>
> If the value from the textbox ($add) is "Hello" then.. do something.
> I think it could be nicely done with IF, but I dont know how to write
this..
>
> Can someone help me, please?
>
> Regards,
> Lab.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to