2016-04-25 103 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)); 

}