Topic awaiting preservation: Just One Checkbox |
|
---|---|
Author | Thread |
Bipolar (III) Inmate From: Raleigh, NC |
posted 04-10-2004 02:17
This is reduclously hard for me to understand... I'm writing a PHP page that has a checkbox on it. code: submit: I know this has to be what's going on beneath the surface. After consulting a coleague, this was my response: code: <form method="post" action="<?php echo $PHP_SELF?>"> So there isn't any pre-submit function that I can just add code to... yet? I'm really confused on this one. code: <input type="checkbox" name="visible" value="<?php echo $visible ?>" <?php echo (($id)?( ($visible == true)?('checked') :('') ) :('checked')); ?> />
|
Bipolar (III) Inmate From: Berlin (almost) |
posted 04-10-2004 02:36
Bmud - code: if (isset($_POST['visible'])) {
|
Bipolar (III) Inmate From: Berlin (almost) |
posted 04-10-2004 02:41
And as for the debugging method your colleague mentioned, you can insert those lines just about anywhere in the file. I have them at the very beginning most of the time so the outputted information is the first thing I see when viewing the page in the browser. |
Bipolar (III) Inmate From: Raleigh, NC |
posted 04-10-2004 20:12
kuckus, that made everything make sense again. Thankyou. Now then, where would i put such a block of code as you suggested? The post command uses the action code: <?php echo $PHP_SELF?> ...can I change that to a function somehow that will run the checking before posting? |
Bipolar (III) Inmate From: Berlin (almost) |
posted 04-10-2004 23:09
It's easiest if you assign a name to the form's submit button - then you can divide your PHP file up into two big parts, one for the form and one for the processing after data has been entered. |