I use Dreamweaver to aid me in my design because while i can logically think things through i couldnt write syntax to save myself.
I have a form for users to upload newsletters, it has two objectives,
Upload the newsletter file
Record information about the file in a table,
I have gotten all this to work, however unlike my other data entry forms without the upload, i cannot get this script to redirect to another page after it has uploaded and made the database entry.
This is the code that is supposed to do it
Code: Select all
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO newsletters (`path`, userid, `day`, `month`, `year`, `size`, type) VALUES ( %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_FILES['userfile']['name'], "text"),
GetSQLValueString($_POST['userid'], "text"),
GetSQLValueString($_POST['day'], "int"),
GetSQLValueString($_POST['month'], "int"),
GetSQLValueString($_POST['year'], "int"),
GetSQLValueString($_FILES['userfile']['size'], "text"),
GetSQLValueString($_FILES['userfile']['type'], "text"));
mysql_select_db($database_thesimon_db, $thesimon_db);
$Result1 = mysql_query($insertSQL, $thesimon_db) or die(mysql_error());
$uploaddir = '/apache2triad/htdocs/knewsl/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile);
$logoutGoTo = "cms-newsletterview.php";
header("Location: $logoutGoTo");Cheers,
Simon
feyd | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]