[php] checkboxes

Greyruin greyruin at gdurkin.com
Thu Apr 28 22:51:17 EST 2005


> <?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 



More information about the php mailing list