Wrox Programmer Forums
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2004, 10:51 PM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 - Help

This is the code for menu2.php

<?php

$Desserts=array("Apple Pie ($3)","Pancakes ($3)","Ice Cream ($2)");

echo "<FORM METHOD=POST ACTION='bill.php'>";
echo "Which of the following would you like as a dessert?";
echo "<SELECT NAME='ListBox2'>";
echo "<OPTION SELECTED VALUE=''>Select...</OPTION>";
echo "<OPTION>$Desserts[0]</OPTION>";
echo "<OPTION>$Desserts[1]</OPTION>";
echo "<OPTION>$Desserts[2]</OPTION>";

echo "</SELECT><BR><BR>";
echo "<INPUT TYPE=HIDDEN NAME=Course1 VALUE='$ListBox1'>";
echo "<INPUT TYPE=SUBMIT>";
echo "</FORM>";
?>

I don't understand where the value for variable $ListBox1 come from? It's like it appear by itself. I do understand that there ia value named 'ListBox1' (not a variable) passed from menu1.php. But in menu2.php, there is no value assigned to the variable $ListBox1 at all. I thought there is another code needed for menu2.php like $ListBox1 = $_POST['ListBox1']; Then the variable $ListBox2 has a value now. I am really confused. I really appreciate if someone can help me out here.

 
Old October 15th, 2004, 08:43 AM
Authorized User
 
Join Date: Jul 2004
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to rajuru Send a message via Yahoo to rajuru
Default

Though I am not sure I think that
you are in form no. 2; previously you have submitted another form. and here $ListBox1 variable contains the value that passed from previous page.

I think, before PHP 4.1 we use the variable name directly to retrieve any value, that passed with the URL.

But after PHP 4.1 we use $_POST['variable'].

thanks

Best Regard:
Md. Zakir Hossain (Raju)
Webmaster
www.rubd.net





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 2 - End of chapter exercises whizzkid1892 BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 July 30th, 2008 12:02 PM
chapter 7 - chapter 11 pelopito BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 3 January 6th, 2008 11:40 AM
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.