switch ($formident) {
case "form1":
.... your action for this form ....
break;
case "form2":
....
and so on.
Edwin
Mark wrote:
I haven't been following any other threads relating to this, but you might try the following. It's not a recommended way to do things, as you can't verify the fields being posted, but it should work. I am assuming there is no correlation between the various forms being submitted. <? // initialize the variables contaning the lists of fields and values $ins_fields="" $ins_vals="" // build the strings containng the fields and values foreach($HTTP_POST_VARS as $key=>$val) { $ins_fields.="$key,"; $ins_vals.="'$val',"; } // strip off the last comma $ins_fields=substr($ins_fields,0,-1) $ins_vals=substr($ins_vals,0,-1) $query="insert into ads ($ins_fields) VALUES ($ins_vals)"; $result=mysql_query($query) or die("Could not insert values"); ?> --- Addison Ellis <addison@bellsouth.net> wrote:hello again and i am sorry i was not more specififc in my last
post.
here is where i am confused:
else {
$today = date("Y-m-d h:m:s");
$sql = "INSERT INTO ads ("") VALUES
('$first_name','$last_name','$email','$phone','$univ_status',
'$password','$today')";
mysql_query($sql);
$auth="yes"; $logname = $email;
for the actual insert, what do i put in order to avoid having to do
a separate .php for each form and list the fields/values from each form? thanks and sorry again. addison
previous post:
hello,
can someone help me with this? i have tried all i know and i am very new at this... my apologies.
i am trying to have multiple forms, all with different fields/values, point to one .php that will foreach($HTTP_POST_VARS
as $key => $VALUE)
1) check for if ($value == "")
2) ereg function
3) $$key = strip_tags(trim($value));
4) $today = date("yyyy-m-d");
5) $sql = "INSERT INTO tablename ("$HTTP_POST_VARS)
VALUES ('$$HTTP_POST_VARS values')";
mysql_query($sql);
the problem i am having is i have so many different form fields/values. i am almost resigning to having one .php for each
form but i know there is a better way. and... anyway... thanks for
looking at this. best regards, addison
--
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
===== Mark Weinstock mark_weinstock@yahoo.com *************************************** You can't demand something as a "right" unless you are willing to fight to death to defend everyone else's right to the same thing. -Stolen from the now-defunct Randy's Random mailing list. *************************************** __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php