472,981 Members | 1,462 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,981 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 3669
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

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.