Hi, I currently have this code which checks if the getCustomData() has an integer to process the next function. If empty of "0", it doesn't fetch payment.php <?php $price = (int) getCustomData(); if( $price ) { ?> <div style="text-align:center;"> Price : $<?php echo getCustomData();?> <?php require( 'payment.php' ) ?> </form> </div> <?php } ?> Code (markup): However, now payment.php has changed a lot so I need to make it so that if "0" or "free" is passed as getCustomData(), payment.php should not be parsed/processed. If that makes sense? Many thanks
<?php $price = (int) getCustomData(); if( $price != 0 && $price != 'free' ) { ?> <div style="text-align:center;"> Price : $<?php echo getCustomData();?> <?php require( 'payment.php' ) ?> </form> </div><?php } else break; ?> Try it out
Try <?php $price = getCustomData(); if( $price != 0 && $price != 'free' ) { ?> <div style="text-align:center;"> Price : $<?php echo getCustomData();?> <?php require( 'payment.php' ) ?> </form> </div><?php } else break; ?>
Aah, the very first one posted by mulari worked. My bad, I wasn't puting 0 or free inthe right field. Many thanks, mulari and powerextreme.
Just one more request: Is it possible to NOT parse/process payment.php when the getCustomData is EMPTY, but only on 0 or free? Many thanks
if u use this code <?php $price = getCustomData(); if( $price != 0 && $price != 'free' ) { ?> <div style="text-align:center;"> Price : $<?php echo getCustomData();?> <?php require( 'payment.php' ) ?> </form> </div><?php } else break; ?> Code (markup): It will happen that way only i guess
nope, if getCustomData is empty, it doesn't parse payment.php, whereas I want it to parse when its EMPTY, but NOT when 0 or free is defined.
<?php $price = getCustomData(); if( $price != 0 && $price != 'free' && $price == NULL ) { ?> Code (markup): right? doesn't work. :-(
A little confused. Which conditions do you want it to process payment? and which conditions not? When it is 0 or free it does NOT process payment? and when it is empty it does process payment? Because 0 is considered empty. I mean $price == 0 is the same as $price == NULL. Correct me please. So I think when you tell the script to not process payment when its null or free, then contradict by wanting it to process when its empty (null)-- Hope I understand you.
I said this because in the php manual it says: The following things are considered to be empty: "" (an empty string) 0 (0 as an integer) "0" (0 as a string) NULL FALSE array() (an empty array) var $var; (a variable declared, but without a value in a class)
payment.php is now processed/parsed on EMPTY and '0' value, but not only on 'free'. It should also NOT be processed on '0'.
Tried this and it works now as desired. if( $price_cost != 0 || $price_cost != 'free' && $price_cost == NULL ) Code (markup): Thanks all for help.