0

I've been looking on the internet for a while, to see how I can make up my echo'd string. I have been able to make up alot of stuff with examples. But when it comes to my own code, I'm not able to this, even when I do EXACTLY the same stuff.

This is my echo'd PHP:

echo "<div id=\"suggestions\"><h1> Our suggestions for you: </h1>";
$i = 1;
while($row = mysqli_fetch_array($frequency))
{
$query = "SELECT country FROM project.countries WHERE countryID LIKE (".$row['countryID'].")";

$result = mysqli_query($con, $query);
$row = mysqli_fetch_array($result);
$countrysuggestion = $row['country'];

echo "<h2>Suggestion no.".$i." is: ".$countrysuggestion."!</h2>";
$i = $i + 1;
}
echo "</div>";

Then this is our style CSS code:

<style type=”text/css”>
#suggestions{
visibility: hidden;
}
</style>

On our website this echo'd "stuff" doesn't go to invisible. Can anyone help us out here?

8
  • are you sure that mysqli is fetching any data?? Commented Jan 9, 2014 at 14:01
  • So it's echoing out the information but not applying the CSS class to suggestions? Commented Jan 9, 2014 at 14:02
  • have you tried display:none; Commented Jan 9, 2014 at 14:02
  • 5
    I doubt it will make any difference whatsoever, but you've got funny quote characters in type="text/css". Commented Jan 9, 2014 at 14:06
  • 1
    @wickywills It will make a difference. That is the answer. Commented Jan 9, 2014 at 14:09

2 Answers 2

4

assuming that below is your inline-css

<style type=”text/css”>
  #suggestions{
    visibility: hidden;
  }
</style>

change the quotes and visibility: hidden; to

     <style type="text/css"> /* <= notice quote in this line, these are 
apostrophes in yours, this makes a huge difference */
        #suggestions{
           display: none; /*notice none here*/
        }
      </style>

Addition edit

visibility: hidden hides the element, but it still takes up space in the layout.

display: none removes the element completely from the document. It does not take up any space, even though the HTML for it is still in the source code.

Sign up to request clarification or add additional context in comments.

4 Comments

is visibility:none; a proper value?
@GhostEcho : perfect catch mate...that was my bad typo....added an edit in my answer after your comment..+1 to it :)
visibility: none; didn't work. Luckily, the mistake was in the quotes! Thanks alot. Now I can try to set it visible with jQuery!
@RichardDirven : visibility: none; was my bad typo...please see Addition edit part in my answer!! :)
2

Try writing inline CSS as below

echo "<div id='suggestions' style='visibility: hidden;'>
      <h1> Our suggestions for you: </h1>";
echo "</div>";

or change quotes in style tag

 <style type="text/css">
      #suggestions{
           visibility: hidden;
      }
 </style>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.