TFD3 Posted October 14, 2009 Share Posted October 14, 2009 Ok here is what im doing. Im trying to add a background image using php in css but im not sure if I have it set up right. http://www.alabamastormtrackers.com/metar/conditions.php See where it says (Sky: Heavy Rain) I need a graphic to display IF Heavy Rain is present. Trying to explain this best I can.. This is part of the CSS outside of the PHP script. background: #cccccc url(<?php echo $image; ?>); Here is the IF statement im not sure if I set up right. if ($wxInfo['CONDITIONS'] == Heavy Rain) { $image = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png"; } Here is the whole script: http://www.alabamastormtrackers.com/metar/script.txt If you run the script your self to test you will also need this: http://www.alabamastormtrackers.com/metar/conditions_metars.txt Here is an EXAMPLE of what it should look like http://www.alabamastormtrackers.com/metar/example.php I have no idea what im missing????? THANKS Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/ Share on other sites More sharing options...
MatthewJ Posted October 14, 2009 Share Posted October 14, 2009 if ($wxInfo['CONDITIONS'] == "Heavy Rain") { $image = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png"; } see if that helps Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/#findComment-936541 Share on other sites More sharing options...
TFD3 Posted October 14, 2009 Author Share Posted October 14, 2009 if ($wxInfo['CONDITIONS'] == "Heavy Rain") { $image = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png"; } see if that helps Negative Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/#findComment-936543 Share on other sites More sharing options...
MatthewJ Posted October 14, 2009 Share Posted October 14, 2009 Well, either way you needed the quotes around the string... You should check to see that you have error reporting turned on... when I ran the script I got a parse error where the quotes were missing. Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/#findComment-936547 Share on other sites More sharing options...
TFD3 Posted October 14, 2009 Author Share Posted October 14, 2009 Well, either way you needed the quotes around the string... You should check to see that you have error reporting turned on... when I ran the script I got a parse error where the quotes were missing. error reporting is on i was just playing with the script. I wonder if it could be because the entire output is not generated by php? Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/#findComment-936557 Share on other sites More sharing options...
TFD3 Posted October 14, 2009 Author Share Posted October 14, 2009 Ok i played around some more and maybe have found a different way... At the bottom of the script I have added if ($observed == "Overcast") { $icon = "http://www.alabamastormtrackers.com/metar/Rain_Heavy.png"; } echo "<img src=" . "$icon" . ">"; ?> Now the image does display but just in a different location. Is there a way to position the image at the top right portion of the box? http://www.alabamastormtrackers.com/metar/conditions.php Quote Link to comment https://forums.phpfreaks.com/topic/177624-quick-question-for-you-guys/#findComment-936579 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.