title: PHP foreach, CSS and jQuery script.. How to interact?
body: <p>i'm trying to use a jQuery show/hide script on a PHP file, and it goes like this:</p>
  
  <pre><code>&lt;?php
  foreach ($empresas as $empresa) {
  echo "&lt;style type='text/css'&gt;
  .$empresa[teaserid] { 
  width:100%;
  background-color: #CCC;
  color: #000;
  margin-top:10px;
  border:1px solid #CCC;
  position:relative;
  vertical-align:middle;
  }
  .showhide$empresa[teaserid] {
      display:none;
  }
  &lt;/style&gt;";
  echo '&lt;script type="text/javascript"&gt;';
  echo ' $(document).ready(function(){ ';
  echo '         $(\".$empresa[teaserid]\").hide(); ';
  echo '         $(\".showhide$empresa[teaserid]\").show(); ';
  echo '  $(\".showhide$empresa[teaserid]\").click(function(){ ';
  echo '  $(\".$empresa[teaserid]\").slideToggle(), 500; ';
  echo '  }); ';
  echo ' });';
  echo '&lt;/script&gt;';
  echo "&lt;a href='#' class='showhide$empresa[teaserid]'&gt;$empresa[titulo]&lt;/a&gt;&lt;br /&gt;
      &lt;div class='$empresa[teaserid]'&gt;
  TEST&lt;/div&gt;";
  }
  ?&gt;
  </code></pre>
  
  <p>So, what I need is a foreach in php that echoes new CSS values and a new jQuery script. because each DIV needs different CSS and jQuery to relate and be able to show and hide its content. This echoing didn't work. The CSS goes ok, but the jQuery doesn't with the PHP $strings. What can I do?
  Or there's a simpler way to do this? A jQuery function that relates to any current div alone ?
  Thanks anyone who helps me in this one..</p>