Jump to content

Archived

This topic is now archived and is closed to further replies.

anthonydamasco

Multi Page Form

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.