I have the following code that is not functioning properly. I am trying to post a value to mysql db when the li is clicked. First is the js file and the 2nd is my php file. thanks for the assistance.
javascript:
function changeIt(){    
 $("#pagewrap").css({'background-image':'url(/image/HapppsTemplates/BlueTemplates/blueShell.svg)'});
 $.ajax({
  type: "POST",
  url: "templatepost.php",
  data: { tempname: "blueShell.svg"}
});
    }
templatepost.php:
<?php
header("Location: templatetest.php");
require_once("./source/include/membersite_config.php");
if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}
mysql_connect("xxx", "xxx", "xxx") or die(mysql_error());
mysql_select_db("xxx") or die(mysql_error());
$test = $fgmembersite-> UserID();
    $template_name = $_POST ['tempname'];
$query = "UPDATE events SET tempname= '".$template_name."' WHERE id_user = '$test'"
or die(mysql_error());
?>
 
    