Can anybody help me on how I can stop an heading displaying if there are no search results?
The app generates palettes based on flickr images, at the minute I have a few else statements for validation that if there are no results from the flickr API etc, then a message will appear, as shown:
// No results from Flickr
} else {
echo "<div class=\"errormsg\"> Uh oh... no results for that Hex. Why not try a keyword?</div>";
}
} else {
// Error with the Flickr API
echo "<div class=\"errormsg\"> Oh boy... there was an error with the API.</div>";
}
} else {
// No hex code entered
echo "<div class=\"errormsg\"> Hey, it looks like you forgot to enter a hex code - Try again!</div>";
}
If there are results it will display a heading (#welcomeDiv) stating
Displaying palettes for...
However, I only want this to display if there are results, I have tried:
else{
?>
<style type="text/css">#welcomeDiv{
display:none;
}</style>
<?php
}
welcomeDiv that I want hidden
<?php if (isset($_POST['submit'])) { ?>
<h2 id="welcomeDiv">Displaying palettes for <span class="hex">"<?php echo $_POST['hex'] ?>"</span></h2>
<div id="results">
<?php include 'assets/php/generate.php'; ?>
</div><!--/results-->
<?php } ?>
But this doesn't apply. Does anybody know why?
Here's a link to the project.