As you know, dreamweaver does a lot of junk with
PHP code... I did some housekeeping and here's what I got..
<?
php require_once('Connections/mydb.
php'); ?>
<?
php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert])) && ($_POST["MM_insert] == "contact")) {
$insertSQL = sprintf("INSERT INTO contact (name, email, title, message) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['message'], "text"));
mysql_select_db($database_mydb, $mydb);
$Result1 = mysql_query($insertSQL, $mydb) or die(mysql_error());
$insertGoTo = "contact_success.
php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo = "contact_success.
php";
}
}
?>
The problem is that it would work, but there is no redirect to contact_success.
php. Actually, what I deleted was just a switch, which contained like 10 lines. That switch does nothing but determine if the text input is string, integer, or anything, and as you see, I put the one for the integer.
I was not the one who wrote this messy code so I do not know what is actually happening. To me, it is just one whole lump of messed-up, very very fragily inter-linked code.
Can someone please help reverse engineer this, and tell me what I should do to do the redirect to "contact_success.
php". I don't know what the variable $insertGoTo does, it all seems sooo confusing..
<form action="<?
php echo $editFormAction; ?>" method="POST" name="contact" id="contact">
Name :
<input name="name" type="text" id="name" size="30" maxlength="30">
</p>
Email :
<input name="email" type="text" id="email" size="30" maxlength="30">
</p>
Title :
<input name="title" type="text" id="title" size="50" maxlength="50">
</p>
Message :</p>
<textarea name="message" cols="70" rows="8" id="message"></textarea>
</p>
<input name="clearval" type="reset" id="clearval" value="Clear Values">
<input name="Send" type="submit" id="Send" value="Send">
</p>
<input type="hidden" name="MM_insert" value="contact">
</form>
That's the form code above. But its actually nothing..