PHP with forms not working

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

PHP with forms not working

Post by coindood »

I've been trying to get forms and php working forever, using code from everywhere like http://hotwired.lycos.com/webmonkey/01/ ... rogramming
for forms examples, butwhenever I put the files on my computer, the variables never get sent. I'm using Apache 2.0, and I know it's not apache because it happens with 1.3 with me, and PHP 4.3.4.
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

Nevermind

Post by coindood »

just searched! sorry! shoulda searched furst!
:roll:
User avatar
phpcoder
Forum Contributor
Posts: 158
Joined: Sat Nov 02, 2002 1:18 pm
Location: Manchester, UK

Post by phpcoder »

I think u must b accessing ur form data directly by its name such as if u have

Code: Select all

<input type="text" name="me">
then u r accesing it in php as

Code: Select all

echo $me;
try it with

Code: Select all

echo $_POST&#1111;'me'];
coz by default the global variables r off in php.ini file either turn them on
User avatar
patrikG
DevNet Master
Posts: 4235
Joined: Thu Aug 15, 2002 5:53 am
Location: Sussex, UK

Post by patrikG »

The article is dated. To get it working, change

Code: Select all

<?php
print $YourName;
?>
in file "bad_words.php" to

Code: Select all

<?php
print $_POST["YourName"] 
?>
For further reading regarding forms and variables in PHP I suggest http://www.devnetwork.net/forums/viewtopic.php?t=511 which deals exactly with your problem.
coindood
Forum Newbie
Posts: 11
Joined: Mon Jan 19, 2004 2:01 pm

Thanks!

Post by coindood »

Thanks for the posts. I posted the thread about five seconds before I found the answer on the same thread posted above! thanks anyways!
Post Reply