谁能帮助我,我有一个将major_id 设置为隐藏的表单,当我不尝试提交我的表单时,我没有将major_id 值输入我的数据库。我真的很陌生,我不知道该怎么做。我知道我的 jquery 有问题
$(function() {
$(".button").click(function() {
var major_id = $("input[name='major_id']").val('1');
var titlesBg = $("#titlesBg").val();
var subBg = $("#subBg").val();
var smp = $("#smp").val();
var sbu = $("#sbu").val();
var dataString = { 'major_id': major_id , 'titlesBg': titlesBg , 'subBg': subBg , 'smp': smp , 'sbu': sbu };
$sql_check = mysql_query("SELECT * FROM sub_guidelines username =" . $_SESSION['username'] . "order by sub_id desc");
if(isSet($_POST['titlesBg']) || ($_POST['subBg']) || ($_POST['smp']) || ($_POST['sbu']))
{
$major_id = $_GET['major_id'];
$titlesBg = mysql_real_escape_string($_POST['titlesBg']);
$subBg = mysql_real_escape_string($_POST['subBg']);
$smp = mysql_real_escape_string($_POST['smp']);
$sbu = mysql_real_escape_string($_POST['sbu']);
$username = $_SESSION['username'];
mysql_query("insert into sub_guidelines(username, major_id, titlesBg, subBg, smp, sbu) values ('$username','$major_id','$titlesBg','$subBg','$smp','$sbu')");
$sql_in= mysql_query("SELECT * FROM sub_guidelines WHERE username = '$username' AND major_id = '$major_id' order by sub_id desc");
$row = mysql_fetch_array($sql_in);
}