Re: [PHP] Protocol on handling empty checkbox values

2002-08-20 Thread Justin French
Oooops! Go back to isset() or emoty() Justin on 21/08/02 9:48 AM, David Yee ([EMAIL PROTECTED]) wrote: > Doh- just discovered that this won't work for updates (e.g. if value is > already = 'Y' and you uncheck the box it'll stay as 'Y'). > > David > >> To throw in a curve-ball, you can set

Re: [PHP] Protocol on handling empty checkbox values

2002-08-20 Thread David Yee
Doh- just discovered that this won't work for updates (e.g. if value is already = 'Y' and you uncheck the box it'll stay as 'Y'). David > To throw in a curve-ball, you can set the default value for your MySQL > column to 'N', which means that any value you DON'T write will be 'N', and > those yo

Re: [PHP] Protocol on handling empty checkbox values

2002-08-17 Thread Jason Wong
On Saturday 17 August 2002 17:40, David Yee wrote: > > It's not PHP's fault -- it's the CGI/POST specs. The browser is not > > sending > > > it through, because that's what it was told to do :) > > Ah- got it. That would make sense since it's the browser that's send the > form data to the server

Re: [PHP] Protocol on handling empty checkbox values

2002-08-17 Thread David Yee
> It's not PHP's fault -- it's the CGI/POST specs. The browser is not sending > it through, because that's what it was told to do :) > Ah- got it. That would make sense since it's the browser that's send the form data to the server, and if it doesn't chose to I wonder why the CGI/POST spe

Re: [PHP] Protocol on handling empty checkbox values

2002-08-16 Thread Justin French
on 17/08/02 3:19 PM, David Yee ([EMAIL PROTECTED]) wrote: > Great idea! Actually after I posted the question I thought of the same > thing :-). This is probably the most elegant way. I am curious though why > PHP doesn't just create the variable anyways and just assign it a null value > if the

Re: [PHP] Protocol on handling empty checkbox values

2002-08-16 Thread David Yee
> I'd use an array on some way, but the other option is to see if the var is > set, else set it to N > > if(isset($_POST['my_checkbox_var'])) { > $_POST['my_checkbox_var'] = 'N'; > } > > > Probably what I'd do is create an array for the possible checkbox values, > then USE THAT ARRAY to build

Re: [PHP] Protocol on handling empty checkbox values

2002-08-16 Thread Justin French
I'd use an array on some way, but the other option is to see if the var is set, else set it to N if(isset($_POST['my_checkbox_var'])) { $_POST['my_checkbox_var'] = 'N'; } Probably what I'd do is create an array for the possible checkbox values, then USE THAT ARRAY to build the form. Then I

Re: [PHP] Protocol on handling empty checkbox values

2002-08-16 Thread James Green
On Fri, 2002-08-16 at 19:24, David Yee wrote: > Hi all. For a universal form script I'm writing I want to store a 'Y' in a > table field if a checkbox is checked and an 'N' if it's not. The problem is > that when the form is posted if the checkbox is not checked the checkbox > variable is not pa

[PHP] Protocol on handling empty checkbox values

2002-08-16 Thread David Yee
Hi all. For a universal form script I'm writing I want to store a 'Y' in a table field if a checkbox is checked and an 'N' if it's not. The problem is that when the form is posted if the checkbox is not checked the checkbox variable is not passed. E.g. If the checkbox is checked, I get $_P