i am trying to point all my forms to this .php file to check for errors, and if they are ok, insert the submitted form values into a table in a database.
if i use this: <? require("config.php"); $error = ""; if ($name == "") { $error = "$error<LI>You must enter a company name.</LI>"; } if ($address == "") { $error = "$error<LI>You must enter an address.</LI>"; }etc. and the form, say yardsale.php, doesn't have the field "name" in it, will it skip over that field or will it return an error saying "name" is blank? or
can you tell me where to go from beyond the attached email below?
below the code following i don't know where to go. do i need to list each value individually or can i do something with $HTTP_POST_VARS or am i even headed in the right direction?
foreach($HTTP_POST_VARS as $key => $value) {
if ($key != "") {
if ($value == "") {
$message_new = "<font face=verdana size=1 color=red>Required information missing.\n
Please try again.</font>";
}
} if (ereg($key)) {
if (!ereg("^[A-Za-z' -]{1,50}$",$key))
{
$message_new = "<font face=verdana size=1 color=red>Some information not processing.\n
Please try again.</font>";
} }
$$key = strip_tags(trim($value)); }
if (!ereg("^[0-9)(xX -]{7,20}$",$contact_phone)) {
$message_new = "<font face=verdana size=1 color=red>Not a valid phone number.\n
Please try again.</font>"; }
if (!ereg("^.+@.+\\..+$",$contact_email)) {
$message_new = "<font face=verdana size=1 color=red>Not a valid email address.\n
Please try again.</font>";
}
else
if ($message == "")
{
$query = "insert into ad_columns set
(from here can i write something like $query = "foreach($HTTP_POST_VARS as $key => $value) insert into ad_columns set???
thank you. addison ellis -- Addison Ellis small independent publishing co. 114 B 29th Avenue North Nashville, TN 37203 (615) 321-1791 addison@bellsouth.net info@smipco.com subsidiaries of small independent publishing co. info@gloabaldog.com info@momandpocentral.com