Ask a Question related to PHP Development, Design and Development.
- Acteon #1
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
Acteon Guest
-
Webservices - POST and GET do not work
Hi there, I wrote a simple Webservice, which works fine on my local(!) machine. I can send data to this service via SOAP, GET and POST. When... -
Form Post Doesn't Work
I have RH9 Linux with the versions of Apache and PHP that came with it. The PHP is version 4.2.2 on the CD, I believe. Apache, I think, is version... -
Post method doesn't work
[email protected] (DrPollo) wrote in news:219e7b39.0307220905.382bb188 @posting.google.com: the $_ superglobals were introduced in PHP... -
post back doesn't work
On Tue, 22 Jul 2003 20:01:44 -0400, "[email protected]" <[email protected]> wrote: I bet you have somewhere in that form an html submit... -
Post method doesn't work: correction
DrPollo wrote: Just tested it here, works fine. However, I don't allow php_shorttag, had to change it to <?php ?> Maybe you can't use... - Richard Hockey #2
Re: php4.3.2 can't get POST to work. 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" <[email protected]> wrote in message
news:[email protected] om...print "Your first name is $_POST["FirstName"].<BR>\n";> 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 $_POST["LastName"].<BR>\n";> print "Your last name is $LastName.<BR>\n";
print "Your E-mail is $_POST["Email"].<BR>\n";> print "Your E-mail is $Email.<BR>\n";
print "This is what you had to say:<BR>\n$_POST["Comments"]<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
Richard Hockey Guest
- Acteon #3
Re: php4.3.2 can't get POST to work. "Richard Hockey" <[email protected]> wrote in message news:<3f0bccef$0$15035$[email protected] m>...
Thank you, that solved the problem. I ended up declaring my variables> 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).
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 ?
Acteon Guest




