473,811 Members | 3,687 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Beginner question on PHP (redhat 9) and variables

I am trying to work through a PHP book that I bought a year or so ago,
"Essential PHP" by Christopher Cosentino. In the beginning of the
book, after the Hello, World .php file, you get to a two-parter : a
form that sends it's results to another .php file, that then displays
those results.

Nothing I have been able to do has gotten this type of passing to
work. Checking the URL string for the second page, it properly shows
the values :

http://localhost/PHP/form_results.ph...t=Submit+Query

However, when I refer to $first_name or $address from the second .php
file, they always render as empty (NULL). I cannot figure out why
this relatively simple case is not working; I can define local
variables and output them, however, I cannot pull the variables from
the URL string, so I can't work with forms.

I'm using a default Redhat 9 install, that came with Apache and PHP
preconfigured. I have made a few unrelated changes to Apache (setting
up SSL, etc) - is there something that needs to be done to get PHP to
work with variables?

Any ideas? I'm at my wit's end...

Thanks a lot!

-- Brian
Jul 17 '05 #1
2 1996
br************@ hotmail.com (Brian) wrote in
news:a0******** *************** **@posting.goog le.com:
I am trying to work through a PHP book that I bought a year or so ago,
"Essential PHP" by Christopher Cosentino. In the beginning of the
book, after the Hello, World .php file, you get to a two-parter : a
form that sends it's results to another .php file, that then displays
those results.

Nothing I have been able to do has gotten this type of passing to
work. Checking the URL string for the second page, it properly shows
the values :

http://localhost/PHP/form_results.ph...st_name=Bibeau
lt&address=My+A ddress&home_pho ne=NA&submit=Su bmit+Query

However, when I refer to $first_name or $address from the second .php
file, they always render as empty (NULL). I cannot figure out why
this relatively simple case is not working; I can define local
variables and output them, however, I cannot pull the variables from
the URL string, so I can't work with forms.


That book probably presupposes that PHP's register_global s option is turned
on, which it was by default in earlier versions of PHP but hasn't been for
the last several releases. And it's generally not a good idea to turn it
on unless you really know what you're doing. The preferred way to access
form parameters is to use the $_GET and $_POST arrays; since in your case
you're using the GET method (parameters passed as part of the URL), you'd
want $_GET. Try looking at $_GET['first_name'] or $_GET['address'] and I
think you'll find what you're looking for.
Jul 17 '05 #2
Eric Bohlman <eb******@earth link.net> wrote in message news:<Xn******* *************** *********@130.1 33.1.4>...
br************@ hotmail.com (Brian) wrote in
news:a0******** *************** **@posting.goog le.com:
I am trying to work through a PHP book that I bought a year or so ago,
"Essential PHP" by Christopher Cosentino. In the beginning of the
book, after the Hello, World .php file, you get to a two-parter : a
form that sends it's results to another .php file, that then displays
those results.

Nothing I have been able to do has gotten this type of passing to
work. Checking the URL string for the second page, it properly shows
the values :

http://localhost/PHP/form_results.ph...st_name=Bibeau
lt&address=My+A ddress&home_pho ne=NA&submit=Su bmit+Query

However, when I refer to $first_name or $address from the second .php
file, they always render as empty (NULL). I cannot figure out why
this relatively simple case is not working; I can define local
variables and output them, however, I cannot pull the variables from
the URL string, so I can't work with forms.


That book probably presupposes that PHP's register_global s option is turned
on, which it was by default in earlier versions of PHP but hasn't been for
the last several releases. And it's generally not a good idea to turn it
on unless you really know what you're doing. The preferred way to access
form parameters is to use the $_GET and $_POST arrays; since in your case
you're using the GET method (parameters passed as part of the URL), you'd
want $_GET. Try looking at $_GET['first_name'] or $_GET['address'] and I
think you'll find what you're looking for.


Thanks a lot, Eric, that was it, exactly. Too bad I didn't hear about
this before I reinstalled Apache and PHP (but the newer version have
other security fixes, so it wasn't wasted time).

-- Brian
Jul 17 '05 #3

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

Similar topics

2
2083
by: Tom Loredo | last post by:
Hi folks- I'm about to move from a Solaris 8/SPARC environment to a Dell running RedHat 9. Are there any issues I need to be aware of in bringing my Python code over (mostly scientific computation)? In particular, I know earlier versions of RH shipped with an "old" Python installed as "python" and that installation of more recent versions should not overwrite "python" (e.g., install as "python2.3"). Is this still the case in RH9? Any...
2
3760
by: Russell E. Owen | last post by:
I'm trying to build Python 2.3.4 from source on a RedHat Enterprise machine for installation in a net-wide accessible directory /net/python. I tried all of the following variants of ./configure (the first was required for Python 2.3.3 on RedHat 9): ../configure --prefix=/net/python --enable-unicode=ucs4 ../configure --prefix=/net/python ../configure --prefix=/net/python --enable-unicode=ucs2 All of these result in the ominous message...
1
1865
by: Dave | last post by:
Hello All, I've created a problem by not reading instruction and now I don't know what to do :( I tried to install 9i on my redhat 9.0 box as myself without going thru the proper procedure of creating the oracle user/dba group etc. Didn't work so I had to break down and read to directions :) Now I believe I have things setup properly, I log in as oracle user, all environment variable are properly set, users/groups, permisions are as...
2
3520
by: tim | last post by:
I was trying to install Oracle on a Linux box with Redhat and got an error message saying the OS had to be Redhat 2.1 or 3.0 (plus some other non-Redhat versions). Does anyone know what I have to do bypass this since I am clearly using a higher version of Redhat.
11
2355
by: Daniel E. Fisher | last post by:
> I can't get a rest for a min guys. > > I go away for the weekend and my server is getting this error. > > Fatal error: Call to undefined function: pg_connect() in > /var/www/html/crohns/phpBB2/db/postgres7.php on line 79 Your PHP doesn't have support for PostgreSQL. Look at phpinfo();
1
2917
by: Michael A. Miller | last post by:
I start PostgreSQL in the services utility under Redhat 9.0 with no issues. PostgreSQL runs properly but as soon as I log out PostgreSQL shuts down. It seems that I always need to be logged in for it to stay running. I am running: Redhat 9.0 Kernel 2.4.20-20.9 PostgreSQL 7.3.4-3.rh19 I am not sure what else could be helpful.
4
2318
by: D. Dante Lorenso | last post by:
This isn't entirely PG related, but... Does anyone know what the natural upgrade path from RedHat 9 is? I'm wondering if anyone on the PostgreSQL team is working with redhat to package and bundle versions of PostgreSQL for the latest redhat. Is there going to be a RedHat 10? Or are we all supposed to choose a path of RH Enterprise vs Fedora Core? I have about 10 to 20 Redhat 9 machines in dev/qa/production that
1
1181
by: Simon Lee | last post by:
Dear all, My php webpages can be ruun normally, However, when they are moved to the other server with Redhat 9, some following problems about php will occur, 1. when the webpage is linked to other page http://www.xxx.com/index.php?item=Aboutus, the "item" variable "Aboutus" is no longer valid, Why? How to tackle such problem them? Does the new version of php no longer support such function,
0
1146
by: Anna C. Dent | last post by:
srb wrote: $ export DISPLAY=myhost:0.0 and have a functioning X-server on myhost I suspect that LD_LIBRARY_PATH does not contain the directory where libjvm.so resides; such as $ORACLE_HOME/lib HTH & YMMV
0
9726
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
10647
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
10384
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...
1
10395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10130
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 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...
0
9204
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
7667
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
5553
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...
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.