I need some help modifying the attached code. It works fine but I need to redirect the user to a different URL if the passed value of form field ‘Paid’ = Y
This is auto generated from dreamweaver:
[php]<?php require_once('Connections/DD.php'); ?>
<?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($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 = $_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 Orders (Name, Email, Team, Player_Num, YouthSmall, YouthMedium, YouthLarge, YouthXL, AdultSmall, AdultMedium, AdultLarge, AdultXL, AdultXXL, Total, Paid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['Email'], "text"), GetSQLValueString($_POST['Team'], "text"), GetSQLValueString($_POST['Player_Num'], "text"), GetSQLValueString($_POST['youthsmall'], "int"), GetSQLValueString($_POST['youthmedium'], "int"), GetSQLValueString($_POST['youthLarge'], "int"), GetSQLValueString($_POST['youthXL'], "int"), GetSQLValueString($_POST['AdultSmall'], "int"), GetSQLValueString($_POST['AdultMedium'], "int"), GetSQLValueString($_POST['AdultLarge'], "int"), GetSQLValueString($_POST['AdultXL'], "int"), GetSQLValueString($_POST['AdultXXL'], "int"), GetSQLValueString($_POST['total'], "int"), GetSQLValueString($_POST['Paid'], "text")); mysql_select_db($database_DD, $DD); $Result1 = mysql_query($insertSQL, $DD) or die(mysql_error()); $insertGoTo = "thankyou.html"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } ?>[/php]Thank you!