HELP!!! I am new to this and trying to teach myself as I go and I am stuck. I can't figure out why this won't work. I am connected to a database and my form has dynamic text boxes on it which are displaying the items from the database just fine. My problem is when I want to do a check to make sure the "Job Number" is entered correctly. My code seems to be overlooked when I select the "submit" button. As a check I have an "echo $jobno" in one of the rows in my table and this number changes whenever I submit my form so I know it is picking this up as a variable. I just don't know what I am missing. This is what I have:
<?php require_once('Connections/Thor.php'); ?>
<?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;
}
$jobno = GetSQLValueString($HTTP_POST_VARS['txtJobNo'], "text");
$prepby = GetSQLValueString($HTTP_POST_VARS['txtPrepby'], "text");
if ($submit){
if (strlen($jobno)<10) {
$error = "Please enter a valid job number";
echo $error;} else
{ echo "Thank you";}}