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($catagor y)) { ?>
<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>Decora tive Lighting
<OPTION kitchenware>Kit chenware & Crockery <OPTION
furniture>Fancy Goods & Furniture
</SELECT>
</td> <td>
<INPUT TYPE=submit VALUE="Search">
</td>
</form>
</div>
<?php exit; }
echo ("the catagory variable was set"); 7 10702
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
just thought of checking the url - thats right, so the problem must be in
my if statement:
end of url:
search.php?sear ch=&catagory=Se arch+All+Catago ries
if statement:
if (empty($catagor y)) {
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_global s 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>
</td> </form> </div>
You forgot to close the table row and the table.
00:53AM in Germany. I'm going to bed now. :-)
Regards,
Matthias
Matthew Robinson wrote: search.php?sear ch=&catagory=Se arch+All+Catago ries
if (empty($catagor y)) {
Read this, _all_ of this http://www.php.net/manual/en/languag...s.external.php
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 =--
thanks again pedro - i am gonna read the manual now (the link you gave me)
Matthew Robinson <ma************ *@hotmail.com> schrieb: search.php?sear ch=&catagory=Se arch+All+Catago ries
if statement:
if (empty($catagor y)) {
if (isset($_GET['catagory'])) {
And you might want to change "catagory" to "category". :-)
Regards,
Matthias
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_global s()!
--
-------------------------
| Jeffrey Silverman |
| jeffrey-AT-jhu-DOT-edu|
------------------------- 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:
-----------------------------------------------------------------------
<script language="JavaScript">
function addProcess(addPName,addSProcess,addPIndex)
{
var addProcessWindow =
window.open('second.asp','mywindow','width=400,height=200');
|
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, but we can't seem to
find a good and clean solution anywhere.
The options we looked into are as follows. Comments following the
options are why we did not want to go with them:
|
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
another. Session variables seem like the easiest, but I'm afraid of
crashing the server after deploying with a few hundred users as opposed to
just a few developers/testers. Any ideas?
|
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
inetpub\anotherproject\test.aspx
|
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 variables, and can do so just fine with a URL, and $_GET.
What I would like to learn, and be very adept at using is the Form functions
and how you pass through that.
The problem in my comprehending this, is how does the original page know how...
| |
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 program.
is this a valid concern? i'm thinking i can check the submitting page
setting up something around the following the following code...
$base_name = basename($_SERVER);
|
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 best....).
Having a class with static parameters????
Having a class that all the pages inherit???
(These last 2 ideas are coming from the news group but I do not quite
understand them).
|
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 done in 3 steps:
Step 1. Normal http login page.
Step 2. A page called login.php that takes the posted username, stores
it as $_SESSION, and registers it
session_register("username"); user is taken to the personalized page
according to his username...
|
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 url)
but how can i assign them to form variables ?
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |