I have been trying for day to figure this out but I keep going around in circles. I am using an array to insert data into a mysql db.
$mainrow=array("jobNum","date_added","type","title","startDate","salary","location","desc","agent","phone","email");
addInfo($currentPage,$mainrow,"index.php",$labels);
public function addInfo( $table , $rows, $page,$rowheaders )
{
$output='<div class="post">';
$i = 0;
$field = array();
$values = array();
foreach ( $rows as $value )
{
array_push($values,"'".$_POST[$value."txt"]."'");
array_push($field,$value);
}
$nvalues= implode(', ',$values);
$fields= implode(', ',$field);
if (isset($_POST['submitted']))
{
$insert = "INSERT INTO $table($fields) VALUES ($nvalues)";
$add_member = mysql_query($insert);
$msg = "You have successfully added an entry<br>";
// //echo "<meta http-equiv='refresh' content='2; URL=".$page."'>";
if (!mysql_query($insert))
{
die('Error:' . mysql_error());
error_reporting(E_ALL);
}
else
{
echo $msg;
}
mysql_close($con);
}
}
Someone PLEASE HELP