[PHP] Passing variable from webpage to php (newbie?)
I think I already tried to post once, so sorry if this is a duplicate, but I don't see my first attempt. I am trying to do what should be a relatively simple and basic task. I've got a php script/page that has a switch/case selection statement in it. Obviously, depending on what value a particular variable takes when passed to the script, the script SHOULD :) do different things. However, when I invoke the script using www.somedomain.com/somephpscript.php?action=1 (substitute one with, 2, 3, 4 or whatever) and then do a check whether any value is passed to my script, it always tells me the value is empty ( if (empty ($action)) - it just always thinks its empty. I'm copying this script from a book, so I do not have any reason to believe there is an error in the code, but obviously something is not happening properly. My thought is that perhaps something needs to be turned on in the php.ini or in the apache httpd.conf file to allow this variable passing to work. Is there some other way to do this? Sorry for the long paragraph sentence. I'll be happy to post the code if needed or provide any additional information or give the actual URL so you can see what is happening. Thanks for any thoughts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php.ini question
I didn't do the installation, but the phpinfo() shows the following: version - 4.2.3 ./configure' '--with-apxs=/usr/local/sbin/apxs' '--with-config-file-path=/usr/local/etc' '--enable-versioning' '--with-regex=system' '--without-gd' '--without-mysql' '--with-zlib' '--with-mysql=/usr/local' '--prefix=/usr/local' 'i386-portbld-freebsd4.7' and the php path info is listed as /usr/local/etc I do have root access as this is not a production machine, but for the life of me cannot seem to get it to read the php.ini file. I believe php and apache are interacting properly, or I wouldn't get the phpinfo() to work. The root of my real problem is that in trying to pass variable values from php scripts to reinvocations of the same script using http://pathtofile.php?action=3 I realize that this is a register_globals thing and that I can access it by one of two ways: 1) Turning register_globals on (which many tell me is a security risk) 2) Using $_REQUEST["action"] 3) $HTTP_POST_VARS and $HTTP_GET_VARS -> with ["action"] However, using the second (haven't tried the 3rd) method and trying to incorporate this variable value into an sql statement it bombs. This may be more appropriate for an sql post, but thought I would throw it up here and see if anyone can shed some light as to how php is interpreting 2) and 3) One workaround I have started with was just assigning the $_REQUEST["action"] value to a new local variable and just using that, but it seems like there would be an easier way and that this method is just a lot of wasted work. Thanks for any thoughts and I am happy to post add'l script details. Joe... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php