RE: [PHP] checking status of a HTML checkbox

From: Date: Fri, 10 Jan 2003 18:29:43 +0000
Subject: RE: [PHP] checking status of a HTML checkbox
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-131165@lists.php.net to get a copy of this message
My apologies for deficient terminology. I define a "regular post" as the original <form action=somewebpage.php method=post> with globals on and the somewebpage.php using the variable sent without using $_POST. But I bet you already knew that :) You asked for the code... My first page has ... ... echo "<form name=Search action=\"".$site."dest.html\" method=post>"; echo "<input type=text size=11 maxlength=11 name=search>"; ?> <br> <INPUT type=text size=3 name=SSN1 maxlength=3 onKeyUp=if(this.value.length==3)th is.form.SSN2.focus();> - <INPUT type=text size=2 name=SSN2 maxlength=2 onKeyUp=i f(this.value.length==2)this.form.SSN3.focus();> - <INPUT type=text size=4 name=S SN3 maxlength=4> </td> ... my second page has... ... if(isset($SSN1) ) { header( "Location: ".$site."newplace.html?SSN1=".$SSN1."&SSN2=".$S SN2."&SSN3=".$SSN3.""); } ... End result being that if they used the text input they would continue with the second page, skipping the new header. I could put a value in the text and leave SSN alone and get sent to the new header. If I put a value in SSN1 I would go to the new header. If I put the echo "hello"; before the header line and leave use the search text box leaving SSN1 blank I would not get the new header. If I used the SSN1 I would get hello and then an error message that the header had already been sent which is what I expected. However, upon removing the hello line again, it went right back to sending the new header whether SSN1 was used or not. Changing the if to reflect if($SSN1 > 0) it works as intended except that some SSN's have leading 0's for their first 3 digits so I am about to use empty(). The > 0 was a quick fix since they needed to use it immediately. PS you'll have to contend with "..." as these scripts 242 and 409 lines long respectively. I can assure you that the form is properly closed on the sending page though. Larry S. Brown Dimension Networks, Inc. (727) 723-8388 -----Original Message----- From: -.Edwin@ns1.dimensionnetworks.com [mailto:-.Edwin@ns1.dimensionnetworks.com]On Behalf Of - Edwin Sent: Friday, January 10, 2003 1:00 PM To: Larry Brown; Shams Cc: php-general@lists.php.net Subject: RE: [PHP] checking status of a HTML checkbox "Larry Brown" <larry.brown@dimensionnetworks.com> wrote: > Also look at empty(). I don't know if the $_POST array will send the > key if it as no variable. I know on a regular post it does send the > variable, but it has no value. What's a "regular post" anyway? Well, the key is passed even when there's even though the field might be empty. > I have used isset with just receiving post data and got > strange results. On one I had an isset statement that ran a result > that Maybe you can post the code--I'm sure somebody here can fix it... ...[snip]... > then isset may not always work. At least not in my experience--it always served its purpose ;) - E ...[snip]... __________________________________________________ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/

« previous php.general (#131165) next »