473,407 Members | 2,320 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,407 software developers and data experts.

Two systems->Two results

I'm just beginning my PHP studies and one of the first tutorials gives
different results. The user is prompted for a Name, and PHP is to say
"Welcome <name>!" on another page. On my hosted server the example works
fine, but on my own machine the message "Welcome !" is displayed,
instead of "Welcome James!" (or whatever). The code:

hello-web.htm

<form action="hello-web.php" method="post">
<td>Name:</td>
<td><input type="text" name="frmName" size="24">
<input type="submit" value="Submit">
</form>
hello-web.php

<p>Hello
<?php echo($frmName); ?>!
And from the log:

[client 127.0.0.1] PHP Notice: Undefined variable: frmName in
C:\\wwwroot\\phpdev\\hello-web.php on line 2, referer:
http://localhost/phpdev/hello-web.htm

The host system is using an older version of PHP and Apache, but I would
think the problem is something else. Anyone have an idea? Thanks.

James
Oct 12 '05 #1
8 1399
register globals issue

in hello-web.php replace $frmName with $_POST['frmName']

Regards And good luck

Anthony
"James" <jm******@triad.rr.com> wrote in message
news:0s*******************@twister.southeast.rr.co m...
I'm just beginning my PHP studies and one of the first tutorials gives
different results. The user is prompted for a Name, and PHP is to say
"Welcome <name>!" on another page. On my hosted server the example works
fine, but on my own machine the message "Welcome !" is displayed, instead
of "Welcome James!" (or whatever). The code:

hello-web.htm

<form action="hello-web.php" method="post">
<td>Name:</td>
<td><input type="text" name="frmName" size="24">
<input type="submit" value="Submit">
</form>
hello-web.php

<p>Hello
<?php echo($frmName); ?>!
And from the log:

[client 127.0.0.1] PHP Notice: Undefined variable: frmName in
C:\\wwwroot\\phpdev\\hello-web.php on line 2, referer:
http://localhost/phpdev/hello-web.htm

The host system is using an older version of PHP and Apache, but I would
think the problem is something else. Anyone have an idea? Thanks.

James

Oct 12 '05 #2
Anthony Dodds wrote:
register globals issue

in hello-web.php replace $frmName with $_POST['frmName']

Regards And good luck

Anthony
"James" <jm******@triad.rr.com> wrote in message
news:0s*******************@twister.southeast.rr.co m...
I'm just beginning my PHP studies and one of the first tutorials gives
different results. The user is prompted for a Name, and PHP is to say
"Welcome <name>!" on another page. On my hosted server the example works
fine, but on my own machine the message "Welcome !" is displayed, instead
of "Welcome James!" (or whatever). The code:

hello-web.htm

<form action="hello-web.php" method="post">
<td>Name:</td>
<td><input type="text" name="frmName" size="24">
<input type="submit" value="Submit">
</form>
hello-web.php

<p>Hello
<?php echo($frmName); ?>!
And from the log:

[client 127.0.0.1] PHP Notice: Undefined variable: frmName in
C:\\wwwroot\\phpdev\\hello-web.php on line 2, referer:
http://localhost/phpdev/hello-web.htm

The host system is using an older version of PHP and Apache, but I would
think the problem is something else. Anyone have an idea? Thanks.

James



Simply amazing! So I guess it was the difference between PHP 5.0.4 on my
local dev system and PHP 4.3.3 on my host. Thanks for the help!

So where's a good PHP tutorial? I mainly want to write a system to
interact with a MySQL database and produce some web pages with the
contents of same.

James
Oct 13 '05 #3
>I'm just beginning my PHP studies and one of the first tutorials gives
different results. The user is prompted for a Name, and PHP is to say
"Welcome <name>!" on another page. On my hosted server the example works
fine, but on my own machine the message "Welcome !" is displayed,
instead of "Welcome James!" (or whatever). The code:
A POST variable is referenced as $_POST['frmName'].
With reasonably non-ancient versions of PHP, this should work
correctly on both your version and the one used by your host.

Gordon L. Burditt
hello-web.htm

<form action="hello-web.php" method="post">
<td>Name:</td>
<td><input type="text" name="frmName" size="24">
<input type="submit" value="Submit">
</form>
hello-web.php

<p>Hello
<?php echo($frmName); ?>!
And from the log:

[client 127.0.0.1] PHP Notice: Undefined variable: frmName in
C:\\wwwroot\\phpdev\\hello-web.php on line 2, referer:
http://localhost/phpdev/hello-web.htm

The host system is using an older version of PHP and Apache, but I would
think the problem is something else. Anyone have an idea? Thanks.

James

Oct 13 '05 #4
James schrieb:

Simply amazing! So I guess it was the difference between PHP 5.0.4 on my
local dev system and PHP 4.3.3 on my host. Thanks for the help!
The difference could be that your host had been set 'register_globals'
on in the php.ini. So where's a good PHP tutorial? I mainly want to write a system to
interact with a MySQL database and produce some web pages with the
contents of same.

James


Kirsten
Oct 13 '05 #5
I noticed that Message-ID:
<q7*******************@twister.southeast.rr.com> from James contained
the following:
So where's a good PHP tutorial? I mainly want to write a system to
interact with a MySQL database and produce some web pages with the
contents of same.


Trouble is, if you know how to do it you don't go looking at tutorials.
:-(

I used the Webmonkey tutorial when I first started, but that is out of
date. I'll have another look round when I get time. Ought to write one
really because a lot of students on my introduction to PHP course often
want to progress. Of course, then you are looking at a lot more stuff,
SQL and the whole relational database thing.

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Oct 13 '05 #6
Kirsten wrote:
James schrieb:
Simply amazing! So I guess it was the difference between PHP 5.0.4 on my
local dev system and PHP 4.3.3 on my host. Thanks for the help!


The difference could be that your host had been set 'register_globals'
on in the php.ini.


Yes, turning register_globals on in php.ini on my local machine fixed
the problem also!
Oct 13 '05 #7
Geoff Berrow wrote:
I noticed that Message-ID:
<q7*******************@twister.southeast.rr.com> from James contained
the following:

So where's a good PHP tutorial? I mainly want to write a system to
interact with a MySQL database and produce some web pages with the
contents of same.

Trouble is, if you know how to do it you don't go looking at tutorials.
:-(

I used the Webmonkey tutorial when I first started, but that is out of
date. I'll have another look round when I get time. Ought to write one
really because a lot of students on my introduction to PHP course often
want to progress. Of course, then you are looking at a lot more stuff,
SQL and the whole relational database thing.


I have a lot of history working with databases, Oracle mostly, just not
MySQL. I have played with Cold Fusion and Access a little bit, but
wanted to build up my skills with Open Source alternatives.
Oct 13 '05 #8
I noticed that Message-ID:
<qL*******************@twister.southeast.rr.com> from James contained
the following:
The difference could be that your host had been set 'register_globals'
on in the php.ini.


Yes, turning register_globals on in php.ini on my local machine fixed
the problem also!


This is a bad idea. If you write scripts that will run with register
globals off, they will run on a server with register globals on. The
reverse is not true.
--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Oct 14 '05 #9

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

Similar topics

0
by: Emine Ekin | last post by:
/*Apologize for multiple posts*/ FIRST CALL FOR PAPERS ADVIS 2006 Fourth Biennial International Conference on Advances in Information Systems 18-20 October, 2006 Izmir, Turkey
27
by: lovecreatesbea... | last post by:
This code snippet is an exercise on allocating two dimension array dynamically. Though this one is trivial, is it a correct one? Furthermore, when I tried to make these changes to the original...
9
by: clintonb | last post by:
I'm looking for a way to calculate the number of days between two dates using standard C++ functions. Would it be as simple as just using the difftime() function and then dividing that result by...
1
by: JosAH | last post by:
Greetings, Introduction This week we start building Query objects. A query can retrieve portions of text from a Library. I don't want users to build queries by themselves, because users make...
0
by: JosAH | last post by:
Greetings, Introduction Last week I was a bit too busy to cook up this part of the article series; sorry for that. This article part wraps up the Text Processing article series. The ...
3
by: Safalra (Stephen Morley) | last post by:
(Note: I'm not trying to do anything stupid based on the user's screen size - I'm just curious.) At work today I was looking at the visitor statistics for a client website, and noticed that...
0
by: JosAH | last post by:
Greetings, welcome back; above we discussed the peripherals of the Library class: loading and saving such an instantiation of it, the BookMark interface and then some. This part of the article...
7
by: WTH | last post by:
I am now aware (I am primarily a C++ developer) that in C# if you reference the same interface from the same file in two different projects the types are actually incompatible. I found this out...
28
by: SzH | last post by:
Suppose that there is a program that takes two files as its command line arguments. Is there a (cross platform) way to decide whether the two files are the same? Simple string comparison is not...
19
by: Sanchit | last post by:
I want to generate a randowm number between two numbers x and y i.e int randomNoBetween(int x, int y); Plz help Is there any such function??
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
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...
0
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,...
0
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...

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.