2016-04-25 127 views
0

我试图发送一个帖子变量到我的表插入值后,dreamweaver为我生成此代码,我试图调整它,使其工作,但没有成功。这里是代码不发送变量到下一页

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) { 
    $insertSQL = sprintf("INSERT INTO links (url, ytname, timeout, `unique`) VALUES (%s, %s, %s, %s)", 
         GetSQLValueString($_POST['url'], "text"), 
         GetSQLValueString($_POST['ytname'], "text"), 
         GetSQLValueString($_POST['timeout'], "text"), 
         GetSQLValueString($_POST['unique'], "text")); 

    mysql_select_db($database_linkdb, $linkdb); 
    $Result1 = mysql_query($insertSQL, $linkdb) or die(mysql_error()); 

    $insertGoTo = "index.php?url=" . $_POST['unique']; 

    header(sprintf($insertGoTo)); 
} 
+0

http://php.net/manual/en/function.error-reporting.php –

+1

'头(sprintf的($ insertGoTo));'和哪里'地点:'进来吗? –

+0

大声笑.....哎呀。谢谢!固定它 –

回答

0

更改您的标题函数值。

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) { 

$insertSQL = sprintf("INSERT INTO links (url, ytname, timeout, `unique`) VALUES (%s, %s, %s, %s)", 
         GetSQLValueString($_POST['url'], "text"), 
         GetSQLValueString($_POST['ytname'], "text"), 
         GetSQLValueString($_POST['timeout'], "text"), 
         GetSQLValueString($_POST['unique'], "text")); 

    mysql_select_db($database_linkdb, $linkdb); 
    $Result1 = mysql_query($insertSQL, $linkdb) or die(mysql_error()); 

    $insertGoTo = "index.php?url=" . $_POST['unique']; 

    header("Location: /".sprintf($insertGoTo)); 

}