LoopyLoo Posted October 1, 2008 Share Posted October 1, 2008 Hi, New to the forum so hello first!! Just starting out in php and joined here hoping to learn more. Sorry, if i'm asking dumb questions. I need an If statement that does the following: If $products_info['products_dcc'] is empty then echo some html/text.... So far I have this: if ($products_info['products_dcc'] = "") { echo "<p><b>DCC Info: " . $product_info['products_dcc'] . "</b></p>"; } Thanks in advance! Lucy. Link to comment https://forums.phpfreaks.com/topic/126684-if-statement-help-needed/ Share on other sites More sharing options...
aeonsky Posted October 1, 2008 Share Posted October 1, 2008 Make sure its.. if ($products_info['products_dcc'] == "") instead of... if ($products_info['products_dcc'] = "") { you can also use the follow function... if (!isset($products_info['products_dcc'])) { isset() only works if the variable had not been set at all. If it was set, but empty, will still evaluate to true. Link to comment https://forums.phpfreaks.com/topic/126684-if-statement-help-needed/#findComment-655204 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.