I used a program called forms2go. It can insert things into database but cannot retrive info so I dont know how to do it.
As you can see for the purpose of the question my table is called "track" and the two fields are called "email" and "description".
<?PHP
######################################################
# #
# Forms To Go 4.2.0 #
# http://www.bebosoft.com/ #
# #
######################################################
error_reporting(E_ERROR | E_WARNING | E_PARSE);
ini_set('track_errors', true);
function DoStripSlashes($fieldValue) {
if ( get_magic_quotes_gpc() ) {
if (is_array($fieldValue) ) {
return array_map('DoStripSlashes', $fieldValue);
} else {
return stripslashes($fieldValue);
}
} else {
return $fieldValue;
}
}
function FilterCChars($theString) {
return preg_replace('/[\x00-\x1F]/', '', $theString);
}
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$clientIP = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$clientIP = $_SERVER['REMOTE_ADDR'];
}
$FTGEmail = DoStripSlashes( $_POST['Email'] );
$FTGDescription = DoStripSlashes( $_POST['Description'] );
$validationFailed = false;
# Include message in error page and dump it to the browser
if ($validationFailed === true) {
$errorPage = '<html><head><title>Error</title></head><body>Errors found: <!--VALIDATIONERROR--></body></html>';
$errorPage = str_replace('<!--FIELDVALUE:Email-->', $FTGEmail, $errorPage);
$errorPage = str_replace('<!--FIELDVALUE:Description-->', $FTGDescription, $errorPage);
$errorList = @implode("<br />\n", $FTGErrorMessage);
$errorPage = str_replace('<!--VALIDATIONERROR-->', $errorList, $errorPage);
echo $errorPage;
}
if ( $validationFailed === false ) {
#====================================================
# Dump field values to a MySQL table =
#====================================================
$mysqlLink = @mysql_connect("localhost", "username", "password");
if (mysql_errno() == 0) {
@mysql_select_db("database", $mysqlLink);
}
if (mysql_errno() == 0) {
$sqlCmd = sprintf("INSERT INTO `track`(`email`, `description`) VALUES('%s', '%s')",
mysql_real_escape_string($FTGEmail, $mysqlLink),
mysql_real_escape_string($FTGDescription, $mysqlLink));
@mysql_query($sqlCmd, $mysqlLink);
}
# Redirect user to success page
header("Location: http://www.xxxxx.com");
}
?>