473,399 Members | 3,106 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Beginner Needs Help With HTTP Parameters

I am trying an example from an O'Reilly book that I just can't get to work.
Can someone tell me where I am going wrong. According to the book, I should
see the values of the HTTP request echoed by the PHP. But obviously they're
not there. All I see is "regionName is wineType is"

Any help would be appreciated.

// index.html
<HTML>
<HEAD>
<TITLE>Explore Wines</TITLE>
</HEAD>

<BODY BGCOLOR="#ffffff">

Explore all our <A
HREF="example.5-4.php?regionName=All&amp;wineType=All">wines</A>

<BR>
Explore our <A HREF="example.5-4.php?regionName=All&amp;wineType=Red">red
wines</A>

<BR>
Explore our <A
HREF="example.5-4.php?regionName=Riverland&amp;wineType=Red">premi um
reds from the Riverland</A>

<BR>
</BODY>
</HTML>
// example.5-4.php
<HTML>
<HEAD>
<TITLE>Parameters</TITLE>
</HEAD>
<BODY>
<?php
echo "regionName is $regionName\n";
echo "wineType is $wineType\n";
?>
</BODY>
</HTML>
Jul 17 '05 #1
3 1556
In order to get those variables from the URL, change the $regionName
variable to $_GET['regionName'] and the $wineType to $_GET['wineType'].

PHP expects those variables to be set somewhere else in the PHP file,
so it doesn't know to look in the URL for the variable.

Jul 17 '05 #2
> I am trying an example from an O'Reilly book that I just can't get to
work.
Can someone tell me where I am going wrong. According to the book, I should see the values of the HTTP request echoed by the PHP. But obviously they're not there. All I see is "regionName is wineType is"


In the early days, PHP made these variables available to use, from version 4
and up however (I believe) they are typically stored in the global arrays
$_GET or $_POST. To minimize the changes required for the O'Reilly examples
to work, just type the following command at the top of your .php file:

<? import_request_variables("gP", "") ?>

Also check out:

http://php.net/manual/en/function.im...-variables.php
Jul 17 '05 #3
> In order to get those variables from the URL, change the $regionName
variable to $_GET['regionName'] and the $wineType to $_GET['wineType'].

PHP expects those variables to be set somewhere else in the PHP file,
so it doesn't know to look in the URL for the variable.

Thanks to both! I guess my book is a bit dated, although it is March 2002.
Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: brian_mckracken | last post by:
This might not be the right group for this question, since its kind of a pure html question... Given the html construct: <form action='index.php?expand=0,10000' method='post'> Email: <input...
12
by: Blaze | last post by:
I am doing the first walk through on the Visual Studio .Net walkthrough book to learn a little about programming. I am having issues with the first tutorial not running correctly. It seems that...
1
by: Tarren | last post by:
Hi: I am new to using datagrids in winforms. How do I modify the parameters of the individual columns in the datagrids. I do not see anything akin to a Columns collection in the datagrid...
1
by: hl | last post by:
Hi, I'm a beginner and need a little help with getting data back from a web service. I am using VB.Net and have added a web reference to a Wsdl that was provided to me. My reference.vb file...
3
by: Rodney Garland | last post by:
Hi All, I am a relative beginner to Python and am looking for help with sending and XML message and getting back a return file. The server is: https://node.deq.state.or.us/node/node.asmx I...
6
by: Chris | last post by:
Hi all, I've recently discovered the joys of tag :) I have a ListView which is populated with strings from a List<>, and each ListView item is linked to the relevant object in List<> using Tag....
18
by: mitchellpal | last post by:
Hi guys, am learning c as a beginner language and am finding it rough especially with pointers and data files. What do you think, am i being too pessimistic or thats how it happens for a beginner?...
4
by: Jessica | last post by:
Can someone look at this code and tell me what is wrong? The error message says "Line 8 Char 1 'dealerId' is undefined" But I thought that I stated everything correctly. Do I have any syntax errors...
22
by: ddg_linux | last post by:
I have been reading about and doing a lot of php code examples from books but now I find myself wanting to do something practical with some of the skills that I have learned. I am a beginner php...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.