I need a better code than that...

From: Date: Tue, 28 Nov 2000 15:24:46 +0000
Subject: I need a better code than that...
Groups: php.general 
Request: Send a blank email to php-general+get-27604@lists.php.net to get a copy of this message
I wanna build a php script to manage a users file (containing basic stuff)... and I want all the functions to be on the same file (it looks pretty neat that way, hehehe)... the form (meant for including a user is via POST) and all the rest (listing, deleting, alter and blabla are used with parameters via GET)... so I did this: <?php $options=array( 1 => stristr($QUERY_STRING,"delete"), 2 => stristr($QUERY_STRING,"list"), 3 => count($HTTP_POST_VARS)>0, 4 => !isset($QUERY_STRING) ); $op; while(list($ind,$bool) = each($options)) { $op=$ind; if($bool) break; } switch($op) { case 1 : delete($delete_email); break; case 2 : list(); break; case 3 : insert($HTTP_POST_VARS); break; case 4 : show_form(basename($PHP_SELF)); break; default: echo "Nothin to do!"; break; } exit; ... functions ... functions... etc... ?> is there a better way of doing this? is there a better way of testing (GET against POST) ? I tried some other stuff like isset($HTTP_POST_VARS) and it doesn't work all the time... sometimes the POST doesn't exactly 'clear' and the option 3 is never true... I need a more clean and bug-free code... can someone help??? . [ Christian Dechery ] . Webdeveloper @ Tá Na Mesa! . Listmaster @ Gaita-L . http://www.tanamesa.com.br

« previous php.general (#27604) next »