View Single Post
Old 03-17-2006, 11:08 AM  
mrkris
Confirmed User
 
Join Date: May 2005
Posts: 2,737
Quote:
Originally Posted by paterson3713
Yeah you could do like:
Code:
$actions['val1'] = 'step1';
$actions['val2'] = 'step2';

// Then, 
$action = $actions[$var];
Or, like it was also mentioned before, using a database:
Code:
// First, put the values into a mysql database like: value | action
// Then,
$action = @mysql_result(mysql_query('SELECT action FROM mySteps WHERE value=\''.mysql_escape_string($var).'\''),0);
Never mix storage with procedure. The easiest thing to do, would be something like:

$method = 'some' . $action;
if (method_exists(array(&$object, $method))) {
$function->$method;
}

I would do something like that ...
__________________

PHP-MySQL-Rails | ICQ: 342500546
mrkris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote