Jump to content

Archived

This topic is now archived and is closed to further replies.

tmac24

String Variable Problem

Recommended Posts

I am a novice at this. With that said... I have a form that used to work on another hosting server and it has stopped working since changing to new hosting server. I keep getting syntax and string variable errors when trying to use the form. Is there a tool to find out what changed between the other php version and the current version? Is there a tool that will help me re-write the file? Thanks in advance for any assistance.

***Note: I did not copy the html portion of the file.

<?php
require_once('Connections/Members.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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO $calbcc60_main, $convention04 (name, company, title, address, city, `state`, zip, email, phone, fax, Full_Registration, After_August1, attendance_day, events, event_only, chamber_member, affiliate, ticket_count, card_type, card_num, expiration_month, expiration_year, nameoncard) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['name'], "text"),
GetSQLValueString($HTTP_POST_VARS['company'], "text"),
GetSQLValueString($HTTP_POST_VARS['title'], "text"),
GetSQLValueString($HTTP_POST_VARS['address'], "text"),
GetSQLValueString($HTTP_POST_VARS['city'], "text"),
GetSQLValueString($HTTP_POST_VARS['state'], "text"),
GetSQLValueString($HTTP_POST_VARS['zipcode'], "int"),
GetSQLValueString($HTTP_POST_VARS['email'], "text"),
GetSQLValueString($HTTP_POST_VARS['phone'], "text"),
GetSQLValueString($HTTP_POST_VARS['fax'], "text"),
GetSQLValueString($HTTP_POST_VARS['Full_Registration'], "text"),
GetSQLValueString($HTTP_POST_VARS['After_August1'], "text"),
GetSQLValueString($HTTP_POST_VARS['attendance_day'], "text"),
GetSQLValueString($HTTP_POST_VARS['events'], "text"),
GetSQLValueString($HTTP_POST_VARS['event_only'], "text"),
GetSQLValueString($HTTP_POST_VARS['chamber_member'], "text"),
GetSQLValueString($HTTP_POST_VARS['affiliate'], "text"),
GetSQLValueString($HTTP_POST_VARS['ticket_count'], "int"),
GetSQLValueString($HTTP_POST_VARS['card_type'], "text"),
GetSQLValueString($HTTP_POST_VARS['card_num'], "text"),
GetSQLValueString($HTTP_POST_VARS['expiration_month'], "int"),
GetSQLValueString($HTTP_POST_VARS['expiration_year'], "int"),
GetSQLValueString($HTTP_POST_VARS['nameoncard'], "text"));

mysql_select_db($database_main, $Members);
$Result1 = mysql_query($insertSQL, $Members) or die(mysql_error());


$insertGoTo = "Reg_Success.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>

Share this post


Link to post
Share on other sites
You could run phpinfo() on both servers and compare them that way.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.