473,382 Members | 1,478 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,382 software developers and data experts.

passing variables between pages

i read a tutorial the other day on passing variables between php pages
using a html form and setting the action to the php page to parse, can
anybody see anything wrong with the code below? the problem is, that the
page always loads the html form, and i cant work out why this is so, even
after i select a catagory from the drop down list and press search. any1
have any idea's? TIA.

the code:

if (empty($catagory)) { ?>
<div align=center>
<form action="<?php $PHP_SELF ?>" method="GET"> <table>
<tr> <td>
<INPUT name=search>
</td> <td>
<SELECT NAME=catagory SIZE=1>
<OPTION any>Search All Catagories
<OPTION floral>Floral Creations
<OPTION lighting>Decorative Lighting
<OPTION kitchenware>Kitchenware & Crockery <OPTION
furniture>Fancy Goods & Furniture
</td> <td>
<INPUT TYPE=submit VALUE="Search">
<?php exit; }
echo ("the catagory variable was set");
Jul 17 '05 #1
7 10684
just thought i would add, that i cant remember the url of the tutorial,
and the notes i took didn't include that part for some unknown reason
Jul 17 '05 #2
just thought of checking the url - thats right, so the problem must be in
my if statement:

end of url:

if statement:

if (empty($catagory)) {

Jul 17 '05 #3
Matthew Robinson <ma*************@hotmail.com> schrieb:
<form action="<?php $PHP_SELF ?>" method="GET"> <table>
Set your error_reporting to E_ALL, so that PHP will inform you of any
errors. Then have a look at the resulting source code of the HTML page
and you should find your error pretty fast. You use $PHP_SELF as a
function, but what you really want is the value of this variable.
Additionally I'd suggest that you use $_SERVER['PHP_SELF']. $_PHP_SELF
will not exist if register_globals is off (which is default since PHP
4.2.0). So your code should be:

<form action="<?php echo($SERVER['PHP_SELF'] ?>" method="GET"> <table>

You forgot to close the table row and the table.

00:53AM in Germany. I'm going to bed now. :-)

Jul 17 '05 #4
Matthew Robinson wrote:

if (empty($catagory)) {

Read this, _all_ of this

and follow a few of the links there, too

a (the usual?) way to do what you want is

if (empty($_GET['catagory'])) {
but do not bypass reading the manual :)
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #5
thanks again pedro - i am gonna read the manual now (the link you gave me)
Jul 17 '05 #6
Matthew Robinson <ma*************@hotmail.com> schrieb:

if statement:

if (empty($catagory)) {

if (isset($_GET['catagory'])) {

And you might want to change "catagory" to "category". :-)

Jul 17 '05 #7
On Thu, 08 Jan 2004 23:34:32 +0000, Matthew Robinson wrote:
i read a tutorial the other day on passing variables between php pages

A lot of on-the-web php tutorials (webmonkey, for example) have gotten out
of date.

Look up register_globals()!

| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|

Jul 17 '05 #8

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

Similar topics

by: Consuelo Guenther | last post by:
Hello, I am having problems with passing variables between pages. I have the following: First asp page has the function: -----------------------------------------------------------------------...
by: Doruk | last post by:
The problem that we are experiencing is simple: We want to pass certain parameters from a page with several server controls to another page. We want to do this in a dotnet compliant manner,...
by: Eric | last post by:
Hello, I am trying to come up with the best way to pass large amounts of data from page to page, namely a data table. The user needs to enter data into a form in one page and confirm it on...
by: Roy | last post by:
Hey all, Is it possible to pass session variables between pages in separate projects? For example: inetpub\thisproject\blah.aspx has a session variable and response.redirects the user to...
by: Khai | last post by:
First off, yes, I understand the crapload of tutorials out there, (well, rather, I understand there /are/ a crapload of tutorials out there), the problem is my comprehension. I'm trying to pass...
by: Skeets | last post by:
i'm passing session and hidden variables between pages. not to mention post values. i'm a little concerned that someone with sufficient knowledge could spoof these vlaues and manipulate the...
by: Carly | last post by:
Hi, I work in Visual Basic .NET 2002 using ASP.NET. I am wondering what would be the best way to store/pass variables between pages. (Sessions are sooo simple to use but I hear they are not the...
by: Smokey Grindle | last post by:
For a website that has users logged into it using sessions, its it best to pass data between pages in session variables or through query strings?
by: K. A. | last post by:
I have two servers at work, 'A' for testing and development, and server 'B' for production. On server A, I wrote a PHP test code to login users then direct them to a personalized page. This is...
by: coool | last post by:
Hi :) anyone knows how can I send variables from a php page to a form - i need to fill the form with these variables ? maybe using (the process of passing variables to other pages - through...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.