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

php4.3.2 can't get POST to work.

Hello,

I've installed php4.3.2 on my Redhat 8.0 box along with Apache2.046.
I'm trying to teach myself some php using Larry Ullman's book "PHP for
the World Wide Web".

There's one example I typed just as it appears in the book but it
dosen't work. I was wondering if there was some setting that needs to
be set in the php config for it to work.

The script is a simple html script, which calls a php script passing
it the variables which it got by the forms:

#########HTML SCRIPT###################
<html>
<head>
<title>HTML Form</title>
</head>
<body>
<form ACTION="HandleForm.php" METHOD=POST>
First Name<input TYPE=TEXT NAME="FirstName" SIZE=20><br>
Last Name <input TYPE=TEXT NAME="LastName" SIZE=20><br>
E-mail Address <input TYPE=TEXT NAME="Email" SIZE=60><br>
Comments <textarea NAME="Comments" ROWS=5 COLS=40></textarea><br>
<input TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
</form>

</body>
</html>

##############PHP SCRIPT "HandleForm.php"#####################
<HTML>
<HEAD>
<TITLE>Form Results</title>
<BODY>
<?php
/* This page receives and handles the data generated by "form.html".
*/
print "Your first name is $FirstName.<BR>\n";
print "Your last name is $LastName.<BR>\n";
print "Your E-mail is $Email.<BR>\n";
print "This is what you had to say:<BR>\n$Comments<BR>\n";
?>
</BODY>
</HTML>

####
This is the output:
Your first name is .
Your last name is .
Your E-mail is .
This is what you had to say:
All the variables are apparently empty. I've also tried with the GET
method. Any idea of what could be wrong in either my script or php
settings ?

Acteon
Jul 16 '05 #1
2 3686
As the other fellow said, do a search for register_globals.

Try using $_POST["myvariable"] and $_GET["myvariable"] to read from
variables, instead of $myvariable. (where myvariable is the name of an
object in the submitted form).

"Acteon" <ac****@yahoo.com> wrote in message
news:be**************************@posting.google.c om...
Hello,

I've installed php4.3.2 on my Redhat 8.0 box along with Apache2.046.
I'm trying to teach myself some php using Larry Ullman's book "PHP for
the World Wide Web".

There's one example I typed just as it appears in the book but it
dosen't work. I was wondering if there was some setting that needs to
be set in the php config for it to work.

The script is a simple html script, which calls a php script passing
it the variables which it got by the forms:

#########HTML SCRIPT###################
<html>
<head>
<title>HTML Form</title>
</head>
<body>
<form ACTION="HandleForm.php" METHOD=POST>
First Name<input TYPE=TEXT NAME="FirstName" SIZE=20><br>
Last Name <input TYPE=TEXT NAME="LastName" SIZE=20><br>
E-mail Address <input TYPE=TEXT NAME="Email" SIZE=60><br>
Comments <textarea NAME="Comments" ROWS=5 COLS=40></textarea><br>
<input TYPE=SUBMIT NAME="SUBMIT" VALUE="Submit!">
</form>

</body>
</html>

##############PHP SCRIPT "HandleForm.php"#####################
<HTML>
<HEAD>
<TITLE>Form Results</title>
<BODY>
<?php
/* This page receives and handles the data generated by "form.html".
*/
print "Your first name is $FirstName.<BR>\n";
print "Your first name is $_POST["FirstName"].<BR>\n";
print "Your last name is $LastName.<BR>\n";
print "Your last name is $_POST["LastName"].<BR>\n";
print "Your E-mail is $Email.<BR>\n";
print "Your E-mail is $_POST["Email"].<BR>\n";
print "This is what you had to say:<BR>\n$Comments<BR>\n";
print "This is what you had to say:<BR>\n$_POST["Comments"]<BR>\n";
?>
</BODY>
</HTML>

####
This is the output:
Your first name is .
Your last name is .
Your E-mail is .
This is what you had to say:
All the variables are apparently empty. I've also tried with the GET
method. Any idea of what could be wrong in either my script or php
settings ?

Acteon

Jul 16 '05 #2
"Richard Hockey" <ri***********@dsl.pipex.com> wrote in message news:<3f***********************@news.dial.pipex.co m>...
As the other fellow said, do a search for register_globals.

Try using $_POST["myvariable"] and $_GET["myvariable"] to read from
variables, instead of $myvariable. (where myvariable is the name of an
object in the submitted form).


Thank you, that solved the problem. I ended up declaring my variables
on top:

$FirstName = $_POST["FirstName"];
$LastName = $_POST["LastName"];

and so on.

This way If I need to use the variable more then once I won't need to
keep typing $_POST["varname"]. Is that how php coders usually do it ?
Jul 16 '05 #3

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

Similar topics

11
by: Ziaran _ | last post by:
I have written a new debugger. I think people will find it useful. Where can I post it for people to download? Thanks, Nir _________________________________________________________________...
1
by: irene | last post by:
Hi, How can I post an existing xml file to a gateway? The idea is that I create an xml file on my end and then I upload(or post) it to a company for them to verify the information and then they...
1
by: NagaKiran | last post by:
Hi I want to post VBA related doubts. Where can I post my doubts in VBA? thanks bye
1
by: kharearchana | last post by:
This is archana how can i post a message
1
peeaurjee
by: peeaurjee | last post by:
I need help over MS Word files can i post my questions here? if NO then where can i put it. Thanks.
2
by: mc | last post by:
where can i post about C# Scripting????
2
by: rezanew | last post by:
Hello, I am developing an application for windows that is going to upload images to a free image hostings... I am using WebClient and UploadData for posting my form to the website... now lets...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...
0
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.