Re: [PHP] 'Require' and 'Select' lists

2005-05-14 Thread Richard Lynch
On Fri, May 13, 2005 5:59 am, Andre Dubuc said:
 However, the behavior continues intermittently. I've duplicated it one
 time.
 If I click on the 'State' dropdown list, allow the mouse to scan through
 it,
 but do not choose a value, and then immediately go to the previous or next
 field and click on it, the box where 'USA or Canada' appears will be blank
 (despite 'option selected value=In USA or CanadaIn USA or
 Canada/option'). For the life of me, I cannot figure why it's doing
 that.

This is a browser/OS bug.

It's possible that it's even time-dependent -- That if you click in the
popup list before it's fully formed, then you can make this happen, but
after it gets completely built, you can't duplicate this.

At any rate, there is nothing you can do about it.

Well, okay, you can complain to the browser-makers, and be ignored by them...

I guess one thing that *MIGHT* help would be to ob_start() before you send
out all the option tags, and then ob_flush()/flush() after the /select
closing tag.

The purpose being that you want the browser to build the whole menu with
as few interruptions as possible, so it will not get used while it is
half-built.

I would not RELY on this actually fixing the problem for sure 100% every
time you betcha, but it could reduce the incidence.

 As a hack, I've included a new routine checking for blank or null value
 for
 $selstate that snags problems before they hit the database. However, I'd
 rather know why this is happening.

Browsers and the data coming from them are flaky, if not downright hostile.

That's just how life is.

It's not a problem to solve.  It's a state of being to accept and plan
for. :-)

Maybe it's time to just re-write the script the right way, the way you
would do it today... :-)

You probably have already spent more time trying to figure this out than
it would have taken to just re-code it with your better experience.

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] 'Require' and 'Select' lists

2005-05-14 Thread Andre Dubuc
On Saturday 14 May 2005 02:14 am, you wrote:
 On Fri, May 13, 2005 5:59 am, Andre Dubuc said:
  However, the behavior continues intermittently. I've duplicated it one
  time.
  If I click on the 'State' dropdown list, allow the mouse to scan through
  it,
  but do not choose a value, and then immediately go to the previous or
  next field and click on it, the box where 'USA or Canada' appears will be
  blank (despite 'option selected value=In USA or CanadaIn USA or
  Canada/option'). For the life of me, I cannot figure why it's doing
  that.

 This is a browser/OS bug.

 It's possible that it's even time-dependent -- That if you click in the
 popup list before it's fully formed, then you can make this happen, but
 after it gets completely built, you can't duplicate this.

 At any rate, there is nothing you can do about it.

 Well, okay, you can complain to the browser-makers, and be ignored by
 them...

 I guess one thing that *MIGHT* help would be to ob_start() before you send
 out all the option tags, and then ob_flush()/flush() after the /select
 closing tag.

 The purpose being that you want the browser to build the whole menu with
 as few interruptions as possible, so it will not get used while it is
 half-built.

 I would not RELY on this actually fixing the problem for sure 100% every
 time you betcha, but it could reduce the incidence.

  As a hack, I've included a new routine checking for blank or null value
  for
  $selstate that snags problems before they hit the database. However, I'd
  rather know why this is happening.

 Browsers and the data coming from them are flaky, if not downright hostile.

 That's just how life is.

 It's not a problem to solve.  It's a state of being to accept and plan
 for. :-)

 Maybe it's time to just re-write the script the right way, the way you
 would do it today... :-)

 You probably have already spent more time trying to figure this out than
 it would have taken to just re-code it with your better experience.


Thanks Richard,

Ain't life beautiful? I live for these debugging moments with *challenged* 
browsers! 

So, I'll stick with the hack. I've thrown the whole mess back at the browser 
and will let the user correct the *problem*.

Re-write the code? Yup, sometime in the near future - around July 2020 - I 
believe I have a few days available :

Regards,
Andre

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



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Richard Lynch
On Thu, May 12, 2005 8:41 pm, Andre Dubuc said:
 I've had some rather odd intermittent behavior with a select list drawn by
 a
 'require' on my production site. Sometimes, rather than displaying 'In
 USA/Canada' from the 'option selectedIn USA/Canada/option' code in the
 required file, it will display a blank. Yet, if I try to duplicate this
 behavior on the development box, it will display as coded.

 Since I use this text string as a validator for user input, it really
 messes
 up the database/code functions that rely on it.

In that case, your validation routines aren't very good.

You have to assume the data coming from the browser is completely messed
up in malicious ways.  If not providing that item in the menu will break
your script or hash your data, then that's really a bigger problem than
the one you think you have.

 ?php require(provcountry.sty); ?

 [snippet of 'require' text (provcountry.sty)]
 tr
 tdbState nbsp;/b/td
 tdSELECT NAME=selstate
   option selectedIn USA/Canada/option

I'd try using an html entity on the '/' in USA/Canada

   option value=AlabamaAlabama/option
 . . .
 /SELECT/td
 /tr

 [snippet of some validating code verifying $selstate that relies on
 $selstate]

 ?php
 if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
  die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
  State'.
 brDo not use bothbrbrClick 'Back' on your  browser to
  re-enter information/h5);
 ?

 Any ideas why this is happening?

It's quite possible that some sort of php.ini setting with Magic Quotes or
something is altering the '/' character as well.

What *IS* in $_POST['selstate'] when it breaks?  Log it and see what the
data is.`

-- 
Like Music?
http://l-i-e.com/artists.htm

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



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Andre Dubuc
On Friday 13 May 2005 02:20 am, Richard Lynch wrote:
 On Thu, May 12, 2005 8:41 pm, Andre Dubuc said:
  I've had some rather odd intermittent behavior with a select list drawn
  by a
  'require' on my production site. Sometimes, rather than displaying 'In
  USA/Canada' from the 'option selectedIn USA/Canada/option' code in
  the required file, it will display a blank. Yet, if I try to duplicate
  this behavior on the development box, it will display as coded.
 
  Since I use this text string as a validator for user input, it really
  messes
  up the database/code functions that rely on it.

 In that case, your validation routines aren't very good.

 You have to assume the data coming from the browser is completely messed
 up in malicious ways.  If not providing that item in the menu will break
 your script or hash your data, then that's really a bigger problem than
 the one you think you have.

  ?php require(provcountry.sty); ?
 
  [snippet of 'require' text (provcountry.sty)]
  tr
  tdbState nbsp;/b/td
  tdSELECT NAME=selstate
  option selectedIn USA/Canada/option

 I'd try using an html entity on the '/' in USA/Canada

  option value=AlabamaAlabama/option
  . . .
  /SELECT/td
  /tr
 
  [snippet of some validating code verifying $selstate that relies on
  $selstate]
 
  ?php
  if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
   die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
   State'.
  brDo not use bothbrbrClick 'Back' on your  browser to
   re-enter information/h5);
  ?
 
  Any ideas why this is happening?

 It's quite possible that some sort of php.ini setting with Magic Quotes or
 something is altering the '/' character as well.

 What *IS* in $_POST['selstate'] when it breaks?  Log it and see what the
 data is.`


Thanks for the info, Richard.

The errant behavior is intermittent and hard to replicate, but it has forced 
me to recode this part completly. [This code was my first attempt at PHP two 
years ago, and it's a bad mix of html/php - I certainly wouldn't do it that 
way again.]

I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating the 
possibility of the slash causing problems.

However, the behavior continues intermittently. I've duplicated it one time. 
If I click on the 'State' dropdown list, allow the mouse to scan through it, 
but do not choose a value, and then immediately go to the previous or next 
field and click on it, the box where 'USA or Canada' appears will be blank 
(despite 'option selected value=In USA or CanadaIn USA or 
Canada/option'). For the life of me, I cannot figure why it's doing that.

As a hack, I've included a new routine checking for blank or null value for 
$selstate that snags problems before they hit the database. However, I'd 
rather know why this is happening.

Logging it - $_POST['selstate'] is blank (after it messes up as above) -- no 
surprise, since that is what the browser displays.

Any other ideas?

Regards,
Andre

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



Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Brent Baisley
Sounds like it might be a browser behavior issue. I've seen some really 
weird behavior in browsers when a DOCTYPE is not declared at the start 
of the web page. The doctype declaration and the version declared in it 
are actually very important to the rendering and behavior of a web  
page. Over the years, browser behavior has changed and will render code 
and perform actions differently. The doctype declaration allows specify 
which version behavior you are targeting.

So, is the first line of your web page something like:
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd;
On May 13, 2005, at 8:59 AM, Andre Dubuc wrote:
Thanks for the info, Richard.
The errant behavior is intermittent and hard to replicate, but it has 
forced
me to recode this part completly. [This code was my first attempt at 
PHP two
years ago, and it's a bad mix of html/php - I certainly wouldn't do it 
that
way again.]

I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating 
the
possibility of the slash causing problems.

However, the behavior continues intermittently. I've duplicated it one 
time.
If I click on the 'State' dropdown list, allow the mouse to scan 
through it,
but do not choose a value, and then immediately go to the previous or 
next
field and click on it, the box where 'USA or Canada' appears will be 
blank
(despite 'option selected value=In USA or CanadaIn USA or
Canada/option'). For the life of me, I cannot figure why it's doing 
that.

As a hack, I've included a new routine checking for blank or null 
value for
$selstate that snags problems before they hit the database. However, 
I'd
rather know why this is happening.

Logging it - $_POST['selstate'] is blank (after it messes up as above) 
-- no
surprise, since that is what the browser displays.

Any other ideas?
Regards,
Andre
--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search  Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] 'Require' and 'Select' lists

2005-05-13 Thread Andre Dubuc
That might be it ( a browser issue) since the behavior seems to occur most in 
Opera. I shudder to think what IE must be doing with it. And blush . . . I 
didn't have that declaration on the required page (since the page only 
contains that code snippet and I thought it unnecessary - guess I was wrong).

I'll give it whirl, and take it out for a test-drive.

Thanks,
Andre

On Friday 13 May 2005 10:51 am, you wrote:
 Sounds like it might be a browser behavior issue. I've seen some really
 weird behavior in browsers when a DOCTYPE is not declared at the start
 of the web page. The doctype declaration and the version declared in it
 are actually very important to the rendering and behavior of a web
 page. Over the years, browser behavior has changed and will render code
 and perform actions differently. The doctype declaration allows specify
 which version behavior you are targeting.

 So, is the first line of your web page something like:
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN
  http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd;

 On May 13, 2005, at 8:59 AM, Andre Dubuc wrote:
  Thanks for the info, Richard.
 
  The errant behavior is intermittent and hard to replicate, but it has
  forced
  me to recode this part completly. [This code was my first attempt at
  PHP two
  years ago, and it's a bad mix of html/php - I certainly wouldn't do it
  that
  way again.]
 
  I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating
  the
  possibility of the slash causing problems.
 
  However, the behavior continues intermittently. I've duplicated it one
  time.
  If I click on the 'State' dropdown list, allow the mouse to scan
  through it,
  but do not choose a value, and then immediately go to the previous or
  next
  field and click on it, the box where 'USA or Canada' appears will be
  blank
  (despite 'option selected value=In USA or CanadaIn USA or
  Canada/option'). For the life of me, I cannot figure why it's doing
  that.
 
  As a hack, I've included a new routine checking for blank or null
  value for
  $selstate that snags problems before they hit the database. However,
  I'd
  rather know why this is happening.
 
  Logging it - $_POST['selstate'] is blank (after it messes up as above)
  -- no
  surprise, since that is what the browser displays.
 
  Any other ideas?
 
  Regards,
  Andre

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



[PHP] 'Require' and 'Select' lists

2005-05-12 Thread Andre Dubuc
Hi,

I've had some rather odd intermittent behavior with a select list drawn by a 
'require' on my production site. Sometimes, rather than displaying 'In 
USA/Canada' from the 'option selectedIn USA/Canada/option' code in the 
required file, it will display a blank. Yet, if I try to duplicate this 
behavior on the development box, it will display as coded.

Since I use this text string as a validator for user input, it really messes 
up the database/code functions that rely on it.

?php require(provcountry.sty); ?

[snippet of 'require' text (provcountry.sty)]
tr
tdbState nbsp;/b/td
tdSELECT NAME=selstate
option selectedIn USA/Canada/option
option value=AlabamaAlabama/option
. . .
/SELECT/td
/tr

[snippet of some validating code verifying $selstate that relies on $selstate]

?php
if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != ))
 die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other
 State'.
brDo not use bothbrbrClick 'Back' on your  browser to
 re-enter information/h5);
?

Any ideas why this is happening?

Tia,
Andre

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