Forum Moderators: coopster

Message Too Old, No Replies

Pulling insert values from multile forms

         

dainstructor

8:38 pm on Feb 21, 2007 (gmt 0)

10+ Year Member



I am currently working on a page that uses two separate forms to gather information and update the database. I would like to know if there is any way I could pull the information from an additional form that is on the page.

Below I have the code that I have thus far. Dreamweaver has helped to create a good deal of this code. It worked when I was only using one form, but now I have separated the first two values(EmpNo and ProjectID) into their own form called 'form4'. I would like for the code to get the values from the new form. Any ideas?


if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form3" )) {
$insertSQL = sprintf("INSERT INTO assignments (empNo, projectID, roleID, active, dateFrom, dateTo, January, February, March, April, May, June, July, August, September, October, November, December) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['EmpNo'], "text"),
GetSQLValueString($_POST['ProjectID'], "int"),
GetSQLValueString($_POST['roleID'], "int"),
GetSQLValueString($_POST['active'], "text"),
GetSQLValueString($_POST['dateFrom'], "date"),
GetSQLValueString($_POST['dateTo'], "date"),
GetSQLValueString($_POST['January'], "double"),
GetSQLValueString($_POST['February'], "double"),
GetSQLValueString($_POST['March'], "double"),
GetSQLValueString($_POST['April'], "double"),
GetSQLValueString($_POST['May'], "double"),
GetSQLValueString($_POST['June'], "double"),
GetSQLValueString($_POST['July'], "double"),
GetSQLValueString($_POST['August'], "double"),
GetSQLValueString($_POST['September'], "double"),
GetSQLValueString($_POST['October'], "double"),
GetSQLValueString($_POST['November'], "double"),
GetSQLValueString($_POST['December'], "double"));

jatar_k

8:51 pm on Feb 21, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



with 2 seperate forms, only the data from the one that was actually submitted will be sent to the script

if you want to include those fields then you would have to write them into the other form as hidden fields, but if they have no values then that won't help

you could use javascript maybe to set the 2 hidden fields to the values entered in the other upon submission of the form

dainstructor

9:04 pm on Feb 21, 2007 (gmt 0)

10+ Year Member



Thanks Jatar_K,

I was thinking along those similar lines and found a way to make it work. I used two hidden fields set with the same values that I populated the other two fields with. Fortunately I didn't have to use Javascript however.

Thanks for the quick reply.