[PHP] Re: form action problem
> 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! empty() and isset() are totally different. If a variable is set, but is set to nothing (or a value of 0), then the isset() will still hold true, whereas empty() will check that the variable contains a value other than a blank or 0. A workaround to the empty() statement? if ( (isset($var)) && (!empty($var)) ) { } or: if ($var!='') { } There are other ways to do this but the main point is making sure the varible is not passed as empty when the form is used. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: form action problem
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" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > hmmdo again as: > > > > > function functionA() > > { > > // your function goes here > > } > > > > if (isset($usefunctiona)) > > { > > functionA(); > > } > > ?> > > > > > > > > > > > > > > > > > > i might try: > > > 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); > } > > ?> > > > > > > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: form action problem
> hmmdo again as: > >function functionA() > { > // your function goes here > } > > if (isset($usefunctiona)) > { > functionA(); > } > ?> > > > > > > > > i might try: 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: form action problem
hmmdo again as: //elias! "Brad Wright" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > i want to have a submit button on a page that has a php function (on the > same page) as the action. > > ie. > > > > > > > so when the 'Use functionA' button is pressed, the function 'functionA() ' > is called (using php variables already defined before the form.) > > Thanks > Brad > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]