[UPHPU] Check boxes and sessions
John
johnh at strictlyrockymountain.com
Tue Sep 14 20:41:22 MDT 2004
<?PHP
session_start()
// you only have to register the session variable name once.
// ie. session_register("name_checkbox");
// as long as this has been done somewhere in some script, and
// you session_start() at the begining of the script page, the
// value will be constant.
// you could also make them as $session['name_checkbox'];
// and then just session_register("session");
session_register("name_checkbox");
session_register("address_checkbox")
session_register("etc.etc.");
?>
<form ....>
<input type="checkbox" name="name_checkbox" value="1">
<input type="checkbox" name="address_checkbox" value="1">
</form>
<?PHP
if ($name_checkbox == "1")
..do something...
etc
?>
Ash, if this isn't clear let me know and I'll make a much more detailed
example. Basically there are 3 parts. 1) make sure the session is
started on each page. 2) make sure that at least somewhere the script is
told to register the variable name of your choice into the saved session
data. 3) obtain the form value (in my example it's "1"), and assign the
form data to the session var name, and that should be enough to make it
work.
--
Thanks
John
> What is the best way to take a checkbox value through a php session?
>
> For example, I have a page that has name, address, phone, zip, city,
> zip, etc.
>
> There's a checkbox next to each one that the person will check if they
> want that info to print on the next page and the page after that.
> Basically the rest of the time they're on the site.
>
> How do I tell if the checkbox has been checked using sessions?
>
> Ash
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: list-unsubscribe at uphpu.org
> For additional commands, e-mail: list-help at uphpu.org
More information about the UPHPU
mailing list