Re: Calling functions from Button actions

From: Date: Sun, 14 Sep 2003 02:56:05 +0000
Subject: Re: Calling functions from Button actions
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-162542@lists.php.net to get a copy of this message
daniel@electroteque.org wrote:
apologies i generally use this system for deleting records, i give a confirm box if they press ok it goes to another action, i suppose i should change this system to submit the form instead and check for the post var ? i guess at least it could store the http_referer then :\
If you're talking about presenting a list of records and using a button to delete a record, then you should use a method such as this... <input type="submit" name="delete[xx]" value="Delete"> Where "xx" is the record_id (or equivalent). Then, when the form is submitted, you just look for $_REQUEST['delete'], make sure it's an array, grab the key using key(), and delete that record. Simple, eh? :) If you want an easy method for presenting a list of records and radio buttons for each record with different statuses (like open, closed, pending, delete, etc), and handling the status changes, check out my column in the latest issue of php|architect. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals – www.phparch.com

« previous php.general (#162542) next »