thanks for your reply but it doesn't work, i get the following output: INSERT INTO Table (Object, Object, Object, Object, ) Values (, , , , )
any ideas? "Bobby Patel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > $fields=''; > $values=''; > > foreach ($_POST as $field -> $value) { > $fields .= $field.", "; > $values .=$value.", "; > } > $fields = substr ($fields, -2); // strip off last comma and space > $values = substr ($values , -2); // strip off last comma and space > > $query = "INSERT INTO $_GET[table_name] (".$fields.") Values (".$values.")"; > > > "St" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hi, > > > > Is it possible to scroll through values posted from a form using PHP? Here > > is my problem: I have a form on a page which is created dynamically from > the > > number of fields in a particular table, so when I POST the data how do I > > create the INSERT statement? I feel this will be awkward due to the > > construction of the INSERT statement and I would be very grateful for > > anyone's input. The form names are the same as the field alues in the > > table... > > > > It will need to be something like > > > > $query = " > > > > while (more Form Fields){ > > $query = $query + "'form fieldname'"; > > } > > > > $query = $query + ") VALUES ("; > > > > while (more POST Values){ > > $query = $query + "POST Value"; > > } > > > > $query = $query + ")"; > > > > I hope this makes sense to the reader! > > > > Thanks > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php