Re: form action problem

From: Date: Tue, 10 Jul 2001 15:47:47 +0000
Subject: Re: form action problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-57157@lists.php.net to get a copy of this message
Adam, It's really better to use the isset() instead of empty() because if you set the error level report to E_ALL you will see that PHP will produce warnings if the variable is not set at all! "Adam" <adam@wangallery.com> wrote in message news:20010710103418.42043.qmail@pb1.pair.com... > > hmm....do again as: > > > > <? > > function functionA() > > { > > // your function goes here.... > > } > > > > if (isset($usefunctiona)) > > { > > functionA(); > > } > > ?> > > > > <html> > > <body> > > <form name="form1" method="post" > > action="<?=$PHP_SELF?>" > > > <input type="submit" name="usefunctiona" value="Use > > functionA"> > > </form> > > </body> > > </html> > > i might try: > > <?php > > function a() > { > //same idea put function here > } > > function b() > { > //same idea put function here > } > > if (!empty($func_a)) { > a($field1); //this would assume you have passed a variable in the form > to use in the function. > }else if (!empty($func_b)) { > b($field1); > } > > ?> > > <form name="form1" method="post" action="<?php echo $PHP_SELF > ?>" > > <input type="text" name="field" value="insert value to be processed > by > function"> > <input type="submit" name="func_a" value="true"> > </form> > > this would also assume you need multiple functions to be used on the same > form as submit buttons. This seems like the most logical/simple way to do > it. > > -Adam > >

« previous php.general (#57157) next »