What about using a form identifier? In each form, use <input type=hidden name=formident value=form1> and so on. Then, use:

switch ($formident) {
case "form1":
.... your action for this form ....

case "form2":

and so on.


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
// initialize the variables contaning the lists of fields and values


// build the strings containng the fields and values

foreach($HTTP_POST_VARS as $key=>$val) {

// strip off the last comma

$query="insert into ads ($ins_fields) VALUES ($ins_vals)";

$result=mysql_query($query) or die("Could not insert values");


--- Addison Ellis <[EMAIL PROTECTED]> wrote:

hello again and i am sorry i was not more specififc in my last
here is where i am confused:
else {
$today = date("Y-m-d h:m:s");
$sql = "INSERT INTO ads ("") VALUES
$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:

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')";

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
subsidiaries of small independent publishing co.

Mark Weinstock
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.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to