Re: Function calling from url

From: Date: Sat, 06 Sep 2003 17:25:38 +0000
Subject: Re: Function calling from url
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161862@lists.php.net to get a copy of this message
Robin Kopetzky wrote:
I would like to call a function from a <FORM>'s ACTION attribute. This is what I'm trying to do: <FORM ACTION="www.example.com/PHP_FILENAME/function_name?parameter1=x&parameter2=y " etc...> I can include the PHP_FILENAME but passing parameters to the function I can't figure out how to do. Any help would be appreciated.
Ummm... no. You call a PAGE from the action attribute of a form. There is no getting around that. You can call a PHP PAGE that passes variables in the query string, though... action="www.example.com/phpfile.php?function=foo&param1=bar&param2=baar This would give you $_GET['function'], $_GET['param1'], and $_GET['param2'] in your "phpfile.php" page. You then call your function using those variables. If you are smart, you'll put in some validation, also. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#161862) next »