Forum Moderators: coopster

Message Too Old, No Replies

register_globals

Un able to turn on register_globals on mac OSX

         

Neutrino13

8:55 am on Jun 8, 2005 (gmt 0)



I am new to php/mysql. I just obtained a book that teaches you how to use php to handle form info. I created the example form as well as the php script to handle the form input. But when I run the form the $name(Variable) and $email(Variable) will not populate. I tried setting variables ahead of time with gobal variables, but didn't work.

Ex. $name=$_post['name']
$email=$_post['email']

Could anyone please tell me how to either locate the php.ini file on my mac to turn on register_globals or advise on a better way to handle form input with php.

Thanks!

dcrombie

10:14 am on Jun 8, 2005 (gmt 0)



You don't need a php.ini though it is (I think) possible to enable one.
Just add the following to the end of /etc/httpd/httpd.conf:

<IfModule mod_php5.c> 
php_flag register_globals on
</IfModule>

(change php5 to php4 as appropriate)

More information: [entropy.ch...]

;)

Edit: before the wowsers jump in - you can also use the $_GET and $_POST global arrays instead of register_globals

mcibor

1:45 pm on Jun 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld!

Don't use register_globals. Use the normal globals: POST, GET, SERVER, COOKIE, SESSION, etc

php is case sensitive, that's why you don't populate the email. It should be capital letters

$name=$_POST["name"];
$email=$_POST["email"];

And make sure that you name (not id) the inputs correctly
<input type="text" name="name">Put in your name

And also make sure that method in form is post, not get:
<form action="#" method="POST">

It should work now, disregarding what's in the php.ini
Best regards
Michal Cibor