I am having a problem inserting into a table using this function. The problem lies withing this lines
INSERT INTO $table ('.implode(',', $rows).') VALUES ('".$_POST[$rows]."')";
Code calling the function
$mainrow = array('info','links');
$display-> addNews($tablename,$mainrow,"index");
Function inside the class
public function addNews( $table , $rows, $page )
{
$output='<div class="post">';
$i = 1;
if (isset($_POST['submitted']))
{
$insert = "INSERT INTO $table ('.implode(',', $rows).') VALUES ('".$_POST[$rows]."')";
$add_member = mysql_query($insert);
$msg = "You have successfully added an entry<br>";
echo "<meta http-equiv='refresh' content='2; URL='$page.php'>";
echo $msg;
echo implode(',', $rows)."<br>";
echo implode(',', $_POST[$rows])."<br>";
}
else
{
$output.= '<form method="post" class="box">';
foreach ( $rows as $v )
{
$output.='<h3>'.$v.'</h3>';
$output.='<textarea name="'.$v.'" class="box_inner">'.$v.'txt</textarea><br>';
}
$i++;
$output.='<br /><input name="submitted" type=submit id="submit" value=submit>';
$output.='</form>';
}
$output.='</div>';
echo $output;
}