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 :\
> [EMAIL PROTECTED] wrote: > >>Dan J. Rychlik wrote: > >>>Is their an easy way to call a function based upon a button action? > >> > >>Example: > >> > >><form action="action.php"> > >><input type="submit" name="action1" value="Execute function > >>action1()"> > >><input type="submit" name="action2" value="Execute function > >>action2()"> > >></form> > >> > >>action.php: > >>function action1() { > >> echo "Hello, I'm action1"; > >>} > >> > >> > >>function action2() { > >> echo "Hello, I'm action2"; > >>} > >> > >>if(isset($_GET['action1'])) { > >> action1(); > >>} > >>if(isset($_GET['action2'])) { > >> action2(); > >>} > > >> wont they both be set ? > > No, only the button that is clicked will be set. > >> i generally use a button type and onclick document.location.href to >> enforce an action in the get variable like >> something.php?action=something > > I wouldn't rely on Javascript... > > ---John Holmes... > > Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ > > php|architect: The Magazine for PHP Professionals – www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php