MDanz Posted May 21, 2010 Share Posted May 21, 2010 i'm trying to echo a variable for padding. $finalposition is an integer. echo "style='padding-top:$finalpositionpx"; i got it working when i put php tags around the variable but that messes up my whole code. it's because of the px. i think php is reading the variable as $finalpositionpx rather than $finalposition. what can i do? Link to comment https://forums.phpfreaks.com/topic/202467-variable-problem/ Share on other sites More sharing options...
Jax2 Posted May 21, 2010 Share Posted May 21, 2010 echo "style='padding-top:' ".$finalposition." px"; Link to comment https://forums.phpfreaks.com/topic/202467-variable-problem/#findComment-1061480 Share on other sites More sharing options...
kenrbnsn Posted May 21, 2010 Share Posted May 21, 2010 You could also do <?php echo "style='padding-top:{$finalposition}px"; ?> Ken Link to comment https://forums.phpfreaks.com/topic/202467-variable-problem/#findComment-1061481 Share on other sites More sharing options...
pengu Posted May 21, 2010 Share Posted May 21, 2010 Crud.. didn't realise it was solved.. sorry! Link to comment https://forums.phpfreaks.com/topic/202467-variable-problem/#findComment-1061495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.