okay, right now, i'm trying to get to the bottom of this, so i'm stripping away as much of the code as possible. Here's what i have so far.
First is my phpbook.php file, which is the following in its entirety:
<?php
Type="MYSQL"
HTTP="true"
$hostname_phpbook = "127.0.0.1";
$database_phpbook = "dwhotel";
$username_phpbook = "root";
$password_phpbook = "";
$phpbook = mysql_pconnect($hostname_phpbook, $username_phpbook,
$password_phpbook) or die(mysql_error());
?>
(and no, i have no root password.)
and then, here's the stripped down page i made based on the big one, which will still not work.
<?php require_once('phpbook.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "userform")) {
$insertSQL = sprintf("INSERT INTO clients (email) VALUES (%s)",
GetSQLValueString($HTTP_POST_VARS['email'], "text"));
mysql_select_db($database_phpbook, $phpbook);
$Result1 = mysql_query($insertSQL, $phpbook) or die(mysql_error());
$insertGoTo = "booking_details.php?email=".$HTTP_POST_VARS['email']."";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form action="<?php echo $editFormAction; ?>" method="POST" name="userform" id="userform">
<input name="email" type="text" id="email">
<input type="submit" name="Submit" value="Submit">
<input type="hidden" name="MM_insert" value="userform">
</form>
</body>
</html>
ok, here's the problem. unlike last time, when i couldn't even get it to show up, it now displays (thanks, elizabeth).
so when I preview the file, i am greeted with a single text box and a submit button, as expected. I enter a random value, and click the button.
Two problems.
One, I don't go where I'm supposed to go: i.e., booking_details.php?email=".$HTTP_POST_VARS['email']."
next, i get the following error message:
Warning: Cannot add header information - headers already sent by (output started at c:\inetpub\wwwroot\dreamweaverhotel\phpbook.php:11) in c:\inetpub\wwwroot\dreamweaverhotel\TMPro0m2gzd4v.php on line 45
and in case it matters, this is on winxp pro, running IIS4, and um...php 4.06.
and as an aside, it does actually input the data into the MySQL database, it's just that it shouldn't be giving me that error message, right?? thanks in advance again...