473,766 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

$_GET['var'] works, but $var doesn't

Hi,
I recently installed the latest Fedora Core 2 but have some troubles of
which I'm not sure are PHP or Apache 2 related... apologies if this is the
wrong group.

"http://www.domain.ltd/index.php?var=1 23&"
Somehow, $var returns an empty value, while $_GET['var'] returns '123'. Need
I change a parameter in php.ini or somewhere else?

Thanks in advance for any help!
Jul 17 '05 #1
4 1949
On Wed, 9 Jun 2004 10:57:18 +0200, "Sjaakie Helderhorst"
<pr**********@t ell.you> wrote:
Somehow, $var returns an empty value, while $_GET['var'] returns '123'. Need


seems you should turn on your register_global s

change the line
register_global s=off

to
register_global s=on

in your php.ini file

or better yet, always user $_GET and $_POST to access your form
variables.

Regards

Marian

--
http://www.heddesheimer.de mailto:ma****@h eddesheimer.de
http://www.rent-a-tutor.com Software on the Web
Jul 17 '05 #2
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/
Jul 17 '05 #3
"Chris Hope" <ch***@electric toolbox.com> schreef in bericht
news:10******** ******@news.ath enanews.com...
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/


Thank you both for your help!
I usually use $_GET and $_POST, but this is a site I 'adopted', so I
encounter some difficulties.
Thanks again!
Jul 17 '05 #4
Regarding this well-known quote, often attributed to Sjaakie Helderhorst's
famous "Wed, 9 Jun 2004 13:35:46 +0200" speech:
"Chris Hope" <ch***@electric toolbox.com> schreef in bericht
news:10******** ******@news.ath enanews.com...
Marian Heddesheimer wrote:
or better yet, always user $_GET and $_POST to access your form
variables.


That's good advice. The good thing about using $_GET['foo'] and
$_POST['foo'] etc rather than enabling register globals and using $foo, is
that it ensures greater portability of your scripts. You may well be able
to register globals on your development box but this may not be the case
with your hosting provider.

--
Chris Hope
The Electric Toolbox - http://www.electrictoolbox.com/


Thank you both for your help!
I usually use $_GET and $_POST, but this is a site I 'adopted', so I
encounter some difficulties.
Thanks again!


For now, you can add code like:

<?php
$INPUTS = array_merge($_G ET, $_POST, $_COOKIE);
// Eliminate any of the $_ vars you don't need.

foreach ($_INPUTS as $currentInput => $thisInput) {
${$currentInput } = $thisInput;
}
?>

(UNTESTED! TRY IT FIRST!)

It's a band-aid procedure, and a bit insecure, but it should tide you over
for now.

--
-- Rudy Fleminger
-- sp@mmers.and.ev il.ones.will.bo w-down-to.us
(put "Hey!" in the Subject line for priority processing!)
-- http://www.pixelsaredead.com
Jul 17 '05 #5

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

Similar topics

0
2601
by: Thomas Carcaud | last post by:
I read php manual many times but I can't figure out register_globals works. I m using Php 4.3.2 and register_globals on. It seems to have different effects on $_GET and $_SESSION. First with $_GET : <? echo $var."\n"; echo $_GET."\n"; $var="gna"; echo $var."\n"; echo $_GET."\n"; $_GET="gnou";
1
2010
by: Keiron Waites | last post by:
I have the following problem: $_POST and $_GET variables can only be used when in the correct format (not $val), but when I define a variable within my PHP page (eg $internal_var = "value" ) it doesn't work and is not found. Why is this? I have this code in an Apache .htaccess file: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /
5
19119
by: gf | last post by:
I had a client recently contact me with a script that wasn't working. I quickly isolated the problem as to the fact that the $_GET array was not being made available to all scripts, even though register_globals was set to ON. The client then notified his host who seemed to know exactly the issue and we added these lines to the top of the script (this script is included in all other scripts) and it solved the problems: /* mp.net patch...
7
11879
by: Dan | last post by:
I was trying to troubleshoot a login page that doesn't work - it keeps saying the login/password is missing - when my tracing discovered this peculiar behavior. register_globals is off, so at the top of my script I assign a few variables to incoming GET and POST values. $login = clean($_POST, 30); $passwd = clean($_POST, 30);
7
14064
by: NotGiven | last post by:
I need to check the $_GET to make certain it is a positive integer. is_integer($_GET) is not working. I think it thinks it's a sting. So I tried casting it to an int using, is_integer((int)$_GET). Then whatever I threw in the _GET variable passed as an integer, even strings. Any ideas or links or functions are much appreciated!
3
1606
by: stephane | last post by:
I have a file.php in which a created dynamic hypertext links and send a variable $row echo "<td><a href='modify_request.php?$row'>$row</a></td>"; I can see in the url on modify_request.php the variable value. But I can't get it in another variable in modify_request.php here is a simple example of what I am trying to do with file1
9
9739
by: wouter | last post by:
hey hi..... I wanna make a switch wich does this: if pagid is set do A, if catid is set do B, if projectid is set do C, else do D. So i was thinking something like this:
21
20706
tpaine
by: tpaine | last post by:
Let me preface this by saying that this is most certainly not a code issue but a config issue. I have been able to implement the code fine on my live server, this problem only occurs on my localhost. I have 7 years experience with various web langauges so we can skip the "METHOD='POST'" comments. I recently setup PHP and Apache (and mySQL) on my windows XP box. This is my first experience with PHP and it took me a long time to get everything...
5
8236
by: chad.a.morris | last post by:
I don't have a lot of experience using $_GET. I need to know how to pass characters in using the $_GET method. The character I'm having a problem with right now is '#', but I'm sure there are others. Could anyone give me a list of characters that need to be escaped using $_GET, and then also how to use them? Also, could you tell me if any characters simply are not allowed in a
0
9568
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
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,...
0
10168
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, 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...
0
10008
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8833
agi2029
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...
1
7381
isladogs
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...
0
6651
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();...
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
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...

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.