title: "insert into $schoolname ('cat','...) The $_POST " if  statement " is not passing values into $schoolname  table
body: <p>I'm having problems getting $schoolname to read in the "insert into" mysqlcommand. </p>
  
  <p>I'm just creating a small thing for a fan club that spans a few schools. So i created a different database table for each school. Each school has a unique id, and the table name corresponds to that.  The code is below. Please help. Well, the problem area is the insert portion. </p>
  
  <p>"insert into $schoolname ('cat','...)
  For some reason $schoolname is not catching with the $_POST if statement</p>
  
  <p>the mysql command " insert into .... " passes  values if i specify a hard coded table name, but it does not pass values if i specify the variable ($schoolname) in place of the table name. I need to specify the variable because there a number of schools with each having their own tables.</p>
  
  <pre><code>    &lt;?php
      require_once('include.php');
      include('imageupload.php');
  
  $schoolid='';
  if(isset($_GET['schoolid']) &amp;&amp; isset($_GET['schoolid']) != '')
  {
      $schoolid .= 'and id ='.$_GET['schoolid'];
  }
  
  $sqlschoolid = "select * from schools where status = 'Active' ".$schoolid;
  $resschoolid = $obj-&gt;sql_query($sqlschoolid);
  $school = $resschoolid[0];
  
  $schoolname = $school['parameter'];
  $schoolid2 = $school['id'];
  
      if($_POST)
  
  
  {
  
  
      (isset($_POST['pr']) &amp;&amp; $_POST['pr'] != "") ? $price=mysql_real_escape_string($_POST['pr']) :  $pr="" ;
  
      $sqlclass = "insert into $schoolname(`category`,`type`,`price`,`title`,`description`,`weburl`,`image`,`email`,`phone`,`address`,`city`,`state`,`zip`,`postdate`,`sponser`,`status`) 
      values('".$_POST['subcategory']."','".$_POST['type']."','".$pr."','".mysql_real_escape_string($_POST['title'])."','".mysql_real_escape_string($_POST['description'])."','".mysql_real_escape_string($_POST['weburl'])."','".$imagename."','".mysql_real_escape_string($_POST['email'])."','".mysql_real_escape_string($_POST['phone'])."','".mysql_real_escape_string($_POST['address'])."','".mysql_real_escape_string($_POST['city'])."','".mysql_real_escape_string($_POST['state'])."','".mysql_real_escape_string($_POST['zip'])."','".date('Y-m-d H:i:s')."','0','Active')";
  
  
      }
  
      ?&gt;
  </code></pre>