[php] checkboxes

Maggie Iaquinto iaquim at bialik.vic.edu.au
Fri Apr 29 07:40:01 EST 2005


Thanks to Greg and David Dawson, my checkboxes now work. I use the POST
method for those variables and then if(isset...)). I gave up on the .=
for the $msg and just used echo.

It all works now.
Maggie


>>> greyruin at gdurkin.com 28/04/05 10:51 PM >>>
> <?php
>
> echo ("The date is: ");
>
> echo date("l, jS F Y");
> echo ("<BR>");
> echo "The current time is: ";
> echo date("H:i.s");
> echo ("<BR><BR><BR><BR><BR><BR>");
>
>
>
> $msg= "You have chosen delicious things such as ";
> if (!empty($chkMeat))
> {
>   $msg .= "<ul>$chkMeat <br>";
> }
> if (!empty($chkVeg))
> {
>   $msg  .= "<ul>$chkVeg<br>";
> }
> if (!empty($chkSweet))
> {
>   $msg  .= "<ul>$chkSweet<br>";
> }
> if (!empty($chkBev))
> {
>   $msg  .= "<ul>$chkBev<br>";
>
> }
> echo "$msg";
>
> ?>


I'm not sure what other configuration options you have on your setup -
and I 
am not familiar with Uniserver - but, is this a scope issue?

I would have in my script either : global $chkMeat, $chkVeg, $chkSweet, 
$chkBev;
or, I would read the values in from the $_POST[] array:
$chkMeat = $_POST['chkMeat'];
etc.

The reason I am somewhat hesitant is that you seem to be getting the 
expected result at home. Uniserver may allow a more relaxed syntax on
the 
expectation of running on a single machine. If so, it would seem a
faulty 
assumption to make if used for further development. Otherwise, you may 
simply have a more relaxed scope option configured on your home setup
(that 
seems to be the safest and most intelligent option from the developer's 
point of view. Certainly, the syntax I have suggested above is the only
one 
that will work in any of my linux setups with php 4.3 , which I use.

I hope this is helpful?

Cheers

Greg 

_______________________________________________
php mailing list
php at edulists.com.au
http://www.edulists.com.au/mailman/listinfo/php



More information about the php mailing list