Im a trying to develop a form which is split into four parts because of its size. Up to now ive always designed my form with all the HTML fields n stuff and had a seperate formhandler which did the PHP stuff. I would like to be able to click a next/submit button after completing the first part, insert the 1st part of the form into the database then go onto the 2nd part of the form- but I would like to be able to click a previous button and have the 1st part of the form I submitted still there with my responses saved (obviously If I went on a previous page and hit next I would like to UPDATE, not insert the 1st part of the form and so on)
How do I walk away from using my traditional approach? Here is my formhandler which is currently a separate doc from the form page:
Sorry about the length of this thread- thanks in anticipation...
<?php
//open connection
error_reporting(E_ALL);
ini_set('display_errors', '1');
$user = "mindseye";
$host = "cpp1.viper.enta.net";
$password = "qwerty11";
$connection = @mysql_connect($host, $user, $password)
or die ("Couldn't connect to server.");
$database = "mindseye";
$db = @mysql_select_db($database, $connection)
or die ("Couldn't select database.");
if (isset($_POST['Submit'])) {
//insert the values into the database
$common_whatexpect = $_POST['common_whatexpect'];
$reliable = $_POST['reliable'];
$cheap = $_POST['cheap'];
$personalservice = $_POST['personalservice'];
$slow = $_POST['slow'];
$qualifiedstaff = $_POST['qualifiedstaff'];
$widechoice = $_POST['widechoice'];
$consistent = $_POST['consistent'];
$approachable = $_POST['approachable'];
$fitforpurpose = $_POST['fitforpurpose'];
$welleducated_staff = $_POST['welleducated_staff'];
$friendly = $_POST['friendly'];
$prompt = $_POST['prompt'];
$attentive = $_POST['attentive'];
$speedyservice = $_POST['speedyservice'];
$meetsneeds = $_POST['meetsneeds'];
$variable = $_POST['variable'];
$takescriticism = $_POST['takescriticism'];
$consistent = $_POST['consistent'];
$providesxtras = $_POST['providesxtras'];
$handmade = $_POST['handmade'];
$responsive = $_POST['responsive'];
$limitedselection = $_POST['limitedselection'];
$competent = $_POST['competent'];
$affordable = $_POST['affordable'];
$accessible = $_POST['accessible'];
$knowledgeablestaff = $_POST['knowledgeablestaff'];
$checkssatisfaction = $_POST['checkssatisfaction'];
$getsdetailsright = $_POST['getsdetailsright'];
$understandscustomers = $_POST['understandscustomers'];
$important1 = $_POST['important1'];
$important2 = $_POST['important2'];
$important3 = $_POST['important3'];
$important4 = $_POST['important4'];
$important5 = $_POST['important5'];
$sql = "INSERT INTO nottsvcs (common_whatexpect,
reliable,
cheap,
personalservice,
slow,
qualifiedstaff_people,
widechoice,
consistent,
approachable,
fitforpurpose,
reliable,
welleducated,
friendly,
prompt,
attentive,
speedy,
meetsneeds,
variable,
takeson,
providesxtras,
handson,
responsive,
ltdselection,
competent,
affordable,
accessible,
knowledgeable,
checkssatisfaction,
getsdetails,
understands,
important1,
important2,
important3,
important4,
important5)
VALUES ('$common_whatexpect'
,'$reliable'
,'$cheap'
,'$personalservice'
,'$slow'
,'$qualifiedstaff'
,'$widechoice'
,'$consistent'
,'$approachable'
,'$fitforpurpose'
,'$welleducated_staff'
,'$friendly'
,'$prompt'
,'$attentive'
,'$speedyservice'
,'$meetsneeds'
,'$variable'
,'$takescriticism'
,'$consistent'
,'$providesxtras'
,'$handmade'
,'$responsive'
,'$limitedselection'
,'$competent'
,'$affordable'
,'$accessible'
,'$knowledgeablestaff'
,'$checkssatisfaction'
,'$getsdetailsright'
,'$understandscustomers'
,'$important1'
,'$important2'
,'$important3'
,'$important4'
,'$important5'
)"
or die (mysql_error());
//execute query and store the result
$res = mysql_query($sql,$connection);
//check to make sure the query actually ran
if(!$res) {
echo mysql_error("Details have been submitted").":".mysql_error()."";
return 0;
echo $sql;
}
}
?>