Jump to content


Photo

Multi Page Form


  • Please log in to reply
2 replies to this topic

#1 anthonydamasco

anthonydamasco
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts

Posted 18 August 2006 - 02:41 PM

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

$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() );

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.

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 18 August 2006 - 02:51 PM

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?

Info: PHP Manual


#3 anthonydamasco

anthonydamasco
  • Members
  • PipPipPip
  • Advanced Member
  • 92 posts

Posted 18 August 2006 - 02:55 PM

so if, I write something like

$sql = "UPDATE joborder VALUES (NULL, NULL, NULL, NULL, '$newinfo' ");
mysql_query($sql) or die ( mysql_error() );

whatever fields that have "NULL" on them will not erase the data already in that field?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users