I have looked at this for 5 hours now... stuck
I created a registration form, if the email exists, I display the error message. Sounds simple, but I can't get this to work. I'm at my wits end.
I created this simple example to show what I'm trying to get down. Right now, every submission shows the error message.
Thanks,
<?php require_once('Connections/pawtabs_db.php'); ?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.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;
}
}
$colname_checkRS = "-1";
if (isset($_POST['email'])) {
$colname_checkRS = (get_magic_quotes_gpc()) ? $_POST['email'] : addslashes($_POST['email']);
}
mysql_select_db($database_pawtabs_db, $pawtabs_db);
$query_checkRS = sprintf("SELECT UserID FROM users WHERE UserEmail = %s", GetSQLValueString($colname_checkRS, "text"));
$checkRS = mysql_query($query_checkRS, $pawtabs_db) or die(mysql_error());
$row_checkRS = mysql_fetch_assoc($checkRS);
$totalRows_checkRS = mysql_num_rows($checkRS);
?><?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "";
$_SESSION['WAVT_signup_175_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM($row_checkRS['UserID'] . "",-1,0,"",",.",true,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"signup_175");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" id="signup_form" name="signup_form" >
<input name="email" id="email" type="text" value="" /><br />
<?php
if (ValidatedField('signup_175','signup_175')) {
if ((strpos((",".ValidatedField("signup_175","signup_175").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
email exists
<?php //WAFV_Conditional sign_up.php signup_175(1:)
}
}
}?>
<input name="sign_up_now" id="sign_up_now" type="submit" value="Join!" />
</form>
</body>
</html>
<?php
mysql_free_result($checkRS);
?>