[PHP] weird problem in php

2006-06-12 Thread weetat

Hi all ,

 I have using php 4.3.2 and mysql database.

 I have a form which have select tag which have the value for example 
-New York.


 When use submit the form , i need to find the first occurence of - , 
i use strpos function as shown below :


$country = $_POST['country'];
$findme  = '-';
$pos = strpos($country, $findme);

if ($pos === false) {
  $_logger-logdebug(starting searchChassisTblDB() not found);
} else {
  $_logger-logdebug(starting searchChassisTblDB() found);
}

however it always give false . I did not know why.
Then i did a testing , added below code in the php file without form 
submission, it give true value which what i wanted. Anybody have ideas 
or suggestion what happening ? Any difference when value submitted from 
form ? Thanks


$mystring = '-New York';
$findme  = '-';
$pos = strpos($mystring, $findme);
if ($pos === false) {
   echo The string '$findme' was not found in the string '$mystring';
} else {
   echo The string '$findme' was found in the string '$mystring';
   echo  and exists at position $pos;
}

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



Re: [PHP] weird problem in php

2006-06-12 Thread Dave Goodchild

On 12/06/06, weetat [EMAIL PROTECTED] wrote:


Hi all ,

  I have using php 4.3.2 and mysql database.

  I have a form which have select tag which have the value for example
-New York.

  When use submit the form , i need to find the first occurence of - ,
i use strpos function as shown below :

$country = $_POST['country'];
$findme  = '-';
$pos = strpos($country, $findme);

if ($pos === false) {
   $_logger-logdebug(starting searchChassisTblDB() not found);
} else {
   $_logger-logdebug(starting searchChassisTblDB() found);
}

however it always give false . I did not know why.
Then i did a testing , added below code in the php file without form
submission, it give true value which what i wanted. Anybody have ideas
or suggestion what happening ? Any difference when value submitted from
form ? Thanks

$mystring = '-New York';
$findme  = '-';
$pos = strpos($mystring, $findme);
if ($pos === false) {
echo The string '$findme' was not found in the string '$mystring';
} else {
echo The string '$findme' was found in the string '$mystring';
echo  and exists at position $pos;
}



why don't you echo $_POST['country'] to see  what you get?




--
http://www.web-buddha.co.uk

dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css)

look out for project karma, our new venture, coming soon!


Re: [PHP] weird problem in php

2006-06-12 Thread Rabin Vincent

On 6/12/06, weetat [EMAIL PROTECTED] wrote:

  I have a form which have select tag which have the value for example
-New York.

  When use submit the form , i need to find the first occurence of - ,
i use strpos function as shown below :

$country = $_POST['country'];
$findme  = '-';
$pos = strpos($country, $findme);

if ($pos === false) {
   $_logger-logdebug(starting searchChassisTblDB() not found);
} else {
   $_logger-logdebug(starting searchChassisTblDB() found);
}

however it always give false . I did not know why.
Then i did a testing , added below code in the php file without form
submission, it give true value which what i wanted. Anybody have ideas
or suggestion what happening ?


Perhaps there is a problem with the HTML for your select box.
var_dump($_POST) in your PHP code to check if the value is
being sent correctly.

Rabin

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