From iaquinto at ozemail.com.au Thu Apr 28 10:21:55 2005
From: iaquinto at ozemail.com.au (Maggie Iaquinto)
Date: Thu Apr 28 12:29:23 2005
Subject: [php] checkboxes
Message-ID: <42702CA3.9070709@ozemail.com.au>
I use Uniserver at home with php 5.0.0 and this script works. On
openlab, with ver 4.3.3, the if branches do not appear - only the date,
time and the first $msg.
Any suggestions? Please do not evaluate the text b/c it is just dummied
up for practice.
Maggie
the html file:
checkboxes
the php file:
");
echo "The current time is: ";
echo date("H:i.s");
echo ("
");
$msg= "You have chosen delicious things such as ";
if (!empty($chkMeat))
{
$msg .= "$chkMeat
";
}
if (!empty($chkVeg))
{
$msg .= "$chkVeg
";
}
if (!empty($chkSweet))
{
$msg .= "$chkSweet
";
}
if (!empty($chkBev))
{
$msg .= "$chkBev
";
}
echo "$msg";
?>
From iaquinto at ozemail.com.au Fri Apr 29 00:57:13 2005
From: iaquinto at ozemail.com.au (Maggie Iaquinto)
Date: Thu Apr 28 12:29:35 2005
Subject: [php] checkboxes -- further
Message-ID: <4270F9C9.90707@ozemail.com.au>
Further to myprevious post about checkboxes --
Running phpinfo() on openlab (ver 4.3.4) and my own uniserver (ver
5.0.0), I get the same info. Why don't these variables get displayed on
the openlab server? They get displayed at home using universer with php
ver 5.0.0. Is it due to the version?
Maggie
copied from the variables section of phpinfo( )
_REQUEST["chkMeat"] meat
_REQUEST["chkVeg"] vegetables
_REQUEST["chkSweet"] sweets
_REQUEST["chkBev"] beverages
_POST["chkMeat"] meat
_POST["chkVeg"] vegetables
_POST["chkSweet"] sweets
_POST["chkBev"] beverages
From greyruin at gdurkin.com Thu Apr 28 22:51:17 2005
From: greyruin at gdurkin.com (Greyruin)
Date: Thu Apr 28 22:38:20 2005
Subject: [php] checkboxes
References: <42702CA3.9070709@ozemail.com.au>
Message-ID: <001a01c54bf0$f9bdffe0$0701a8c0@Greyruin>
>
> echo ("The date is: ");
>
> echo date("l, jS F Y");
> echo ("
");
> echo "The current time is: ";
> echo date("H:i.s");
> echo ("
");
>
>
>
> $msg= "You have chosen delicious things such as ";
> if (!empty($chkMeat))
> {
> $msg .= "$chkMeat
";
> }
> if (!empty($chkVeg))
> {
> $msg .= "$chkVeg
";
> }
> if (!empty($chkSweet))
> {
> $msg .= "$chkSweet
";
> }
> if (!empty($chkBev))
> {
> $msg .= "$chkBev
";
>
> }
> 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
From iaquim at bialik.vic.edu.au Fri Apr 29 07:40:01 2005
From: iaquim at bialik.vic.edu.au (Maggie Iaquinto)
Date: Fri Apr 29 07:28:02 2005
Subject: [php] checkboxes
Message-ID:
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@gdurkin.com 28/04/05 10:51 PM >>>
>
> echo ("The date is: ");
>
> echo date("l, jS F Y");
> echo ("
");
> echo "The current time is: ";
> echo date("H:i.s");
> echo ("
");
>
>
>
> $msg= "You have chosen delicious things such as ";
> if (!empty($chkMeat))
> {
> $msg .= "$chkMeat
";
> }
> if (!empty($chkVeg))
> {
> $msg .= "$chkVeg
";
> }
> if (!empty($chkSweet))
> {
> $msg .= "$chkSweet
";
> }
> if (!empty($chkBev))
> {
> $msg .= "$chkBev
";
>
> }
> 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@edulists.com.au
http://www.edulists.com.au/mailman/listinfo/php