This topic is locked

Insert Code if DB field value true

12/2/2011 11:47:55 AM
PHPRunner General questions
W
weisd author

Sorry for the rather newbieish question...
On both my View and List page I want to insert a bit of code only if a field value matches criteria.
if ($manufacturer == "ACME")

include("http://www.weisd.com/ACMEPolicy.html";);
ACMEPolicy.html would be simple html formatted text
I have tried a few different approaches but keep running into errors. Mostly of the undefined variable type...
My original thought was> Insert field and set type to custom and add code there... I must be missing something simple...
Tnx

C
cgphp 12/2/2011

If you are using a custom field the code would be:

if($data['manufacturer'] == "ACME")

{

$value = "<p>Policy bla bla bla</p>"; // here the html code from http://www.weisd.com/ACMEPolicy.html

}

else

{

$value = "";

}


Check the article about the "View as custom" field: http://xlinesoft.com/phprunner/docs/_view_as__settings_custom.htm