anthonydamasco Posted August 18, 2006 Share Posted August 18, 2006 I have a long form that I need to break up into 4 differant html pages, and they all need to be submitted to the same table in the same DB.I use POST scripts to pull information from the form and convert them to variables,then I run a sql script that enters the vars into my database[code=php:0]$sql = "INSERT INTO joborder VALUES (NULL, '$usedbefore', '$nearestlocation', '$companyname', '$firstname', '$lastname', '$department', '$phone', '$fax', '$email', '$address', '$addresstwo', '$city', '$state', '$country', '$zip', '$positiontype', '$dressreq', '$dresscode', '$positionclassification', '$positiontitle', '$employeesneeded', '$timeneeded', '$startdate', '$workinghours', '$workAddress', '$workaddresstwo', '$workcity', '$workstate', '$workzip', '$positiondescription', '$skillsrequired', '$educationrequired', '$additionalrequirements', '$checkedby', '$hourlyrate', SYSDATE(), '$reportto')";mysql_query($sql) or die ( mysql_error() );[/code]The reason for the overly huge database is that we already have a search developed that searches on differant colomns on this DB, anyway, if the form is split up into 4 pages, how do i submit information into the same table in sections without losing any information on other pages. I have a few ideas, but they all seem shadey. So hopefuly some one out there has done this before and can point me in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/17947-multi-page-form/ Share on other sites More sharing options...
ober Posted August 18, 2006 Share Posted August 18, 2006 There are a few ways to do this, but the way I normally do it is to allow nulls in your columns, other than the ID column. Then you just run update statements on the parts of the table that you're updating.So on the first page, you insert the record with only the parts from the first form. On the next 3 forms, all you do is run an UPDATE statement with only the new fields.Does that make sense? Quote Link to comment https://forums.phpfreaks.com/topic/17947-multi-page-form/#findComment-76769 Share on other sites More sharing options...
anthonydamasco Posted August 18, 2006 Author Share Posted August 18, 2006 so if, I write something like[code=php:0]$sql = "UPDATE joborder VALUES (NULL, NULL, NULL, NULL, '$newinfo' ");mysql_query($sql) or die ( mysql_error() );[/code]whatever fields that have "NULL" on them will not erase the data already in that field? Quote Link to comment https://forums.phpfreaks.com/topic/17947-multi-page-form/#findComment-76774 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.