A little if-then help...

Ashley Oviatt ashovi at qwest.net
Fri Apr 23 17:23:47 MDT 2004


Consider the following:

foreach($_POST as $k=>$textfield1)
	{
	if ($k == "Phone_Number" or "Cell_Phone")
		{
		...
		do some pdflib stuff
		...
		}
	}

So I just want the "do some pdflib stuff" to happen if $k == 
"Phone_Number" or "Cell_Phone" . If it equals anything else, just 
continue on in the foreach until it finishes.

"Phone_Number" and "Cell_Phone" are field names in the form I'm posting 
from and when I do a print $k, it says Phone_Number or Cell_Phone 
respectively.

What really happens, though, is that it prints all of the $POST data 
onto the form. If I leave out the or, ie if ($k == "Phone_Number") , 
then it works as I'd expect it to.

Any suggestions?

Ash




More information about the UPHPU mailing list