Wrox Programmer Forums
|
PHP How-To Post your "How do I do this with PHP?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 16th, 2004, 08:52 AM
Authorized User
 
Join Date: May 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default form problem

i am trying to create a simple form where the user enters there favorite activity into a textbox and when they click submit they are taken to my php page where it says "your favorite activity is: (Whatever they entered in the textbox)". for this i am using the method=get and i can see on the php page that the name/values are working properly. However i am not seeing it display properly in the body of the page. I have the php.ini file in my c:\windows dir and i have register_globals= On with not semicolon in front of it. I am using php5 with apache 2.0.49 and have also tried php4.3.7 with apache 2.0.49. does anyone have any ideas on how to get the form to work poperly, i know it is probably something stupid i am overlooking. i tried putting register_globals=on but still doesnt work. after i submit the form the url of the php page is "http://localhost/text.php?Activity=baseball" so i know that the name/values are assigning properly. it just the page only displays
"your favorite activity is:" instead of displaying "your favorite activity is:baseball"

to see what i mean go here: http://paperhuman.tripod.com/index.html
It does not matter that tripod does not support PHP. I am just trying to demonstrate the problem i am having with my apache and php set up.

Any ideas???????
 
Old June 16th, 2004, 10:12 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, regardless of your register_globals setting, writing:

<?php echo "Your favourite activity is: " . $_GET['Activity']; ?>

Should work. Notice that PHP is a case-sensitive language, so $Activity is not the same as $activity.

Any help?
Take it easy
Dan
 
Old June 16th, 2004, 10:22 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Dan,

I believe the problem is that PHP is not installed. At least, that's what it looks like through the given link.

nulogix:

Have you installed PHP?

Snib

<><
 
Old June 16th, 2004, 11:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 256
Thanks: 0
Thanked 0 Times in 0 Posts
Default

AH, this is a cross post from Beg_PHP, I see....

Well, even so, I think what's being said, is that he's put his form up (which is just HTML anyway) onto the web, so that we can see that when it posts, it does, indeed put Author=Tim+O%27Reilly into the querystring :). I gather what he's asking, is that when he runs this on his computer at home (given the references to "localhost" in his posts on the other forum - which appears to have PHP installed) he doesn't get any output from his GOT (getted?) variable in the $_GET array.

This is another hazard of crossposting :).

I suspect Nuogix's just spelt the variable wrong.

let's see what happens next :o{)>

Take it easy,
Dan
 
Old June 16th, 2004, 12:08 PM
Authorized User
 
Join Date: May 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

dan, i checked the variable spelling and bot are correctly spelled the same way. I am completly stumped as to what the problem is. here is the exact code i am using

text.html
<----------------->
<html>
<body>
<form method="get" action="text.php">
<input type="text" name="Author" />
<br />
<br />
<input type="submit" />
</form>
</body>
</html>
<-------------->
text.php
<-------------->
<html>
<body>
your favorite author is:
<?php
echo $Author;
?>

</body>
</html>



I also tried the above on the server at the place i work for and i am getting the exact same problem. So it has got to either be something in my code or something in the php.ini configuration file. Does anyone have any other ideas???

Also i used the <?php echo "Your favourite activity is: " . $_GET['Activity']; ?> and it worked fine. I would just like to know why the above doesnt work.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Problem prasanta2expert C# 1 September 24th, 2007 08:57 PM
Upload.Form problem barkerl Classic ASP Basics 1 January 22nd, 2007 06:06 AM
Sum on a form Problem Corey Access 1 November 9th, 2005 05:43 PM
Form problem HammR Beginning PHP 4 March 17th, 2004 09:14 PM
Form problem tonyh Beginning VB 6 4 October 28th, 2003 03:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.