Hi Wade,
This is what you should have put in the Echo Lines
echo 'Entree: "' . $_POST['Course1'] . '"<br>';
echo 'Dessert: "' . $_POST['ListBox2'] . '"<br><br>';
the $_POST variable is set as an array with the names of each of the POST
variables as Keys to the array. As such $_POST['Course1'] is the
replacement of $Course1.
Keep on trying.
Rob Howard
-----Original Message-----
From: Wade [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 14 January 2003 5:13 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] initialize variables
01132003 2203 CST
I thought I was starting to get it until I got to the last section.
Original code from the book:
<?php
$total = 0;
echo "Your order was for the following:<br><br>";
echo "Entree: $Course1<br>";
echo "Dessert: $ListBox2<br><br>";
foreach (array($Course1, $ListBox2) as $val)
{
if (ereg("[0-9]+", $val, $reg)) $total += $reg[0];
}
echo "TOTAL BILL = $" . $total . "<br>";
?>
I was brave and tried to make many changes but none worked. This is
where I ended up:
<?php
$total= 0;
echo 'Your order was for the following:<br><br>';
echo 'Entree: "' . $_POST . $Course1 . '"<br>';
echo 'Dessert: "' . $_POST . $ListBox2 . '"<br><br>';
foreach (array($Course1, $ListBox2) as $val)
{
if (ereg('[0-9]+', $val, $regs)) $total += $regs[0];
}
echo 'TOTAL BILL = $"' . $total . '"<br>';
?>
The output for this last code is:
Your order was for the following:
Entree: Array
Dessert: Array
TOTAL BILL = $"0"
Enlighten me. Im trying hard to understand where to put things together.
Thanks
Wade
Sean Malloy wrote:
> String concatenation?
>
> Its a way ogf combining strings into one.
>
> $string = 'Hello';
>
> $string = $string . ' World';
>
> echo $string;
>
> would output 'Hello World'
>
> -----Original Message-----
> From: Wade [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, 14 January 2003 4:02 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PHP-WIN] initialize variables
>
>
> 01132003 2059 CST
>
> Sean,
>
> Thats a new one for me. In the line below, what does the " ' .
> $Entrees[0] . ' "> do?
>
> The " . ", do they have some value or do they negate something?
>
> echo '<option value="' . $Entrees[0] . '">' . $Entrees[0] . '</option>';
>
>
> Wade
>
>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
#####################################################################################
This e-mail message has been scanned for Viruses and Content and cleared by MailMarshal
#####################################################################################
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php