I'm trying to send a post variable to the next page after inserting values into my table, dreamweaver generated this code for me, i tried tweaking it to make it work but with no success. Here is the code
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));
}
Change your header function value.
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));
}