I have developed a multipage form that carries out an insert but im stuck on how to incorporate the same approach for updating the record. At the top of each of my forms at present is:
[php
session_start();
require_once('common_functions.php');
$_SESSION['form1_data']='';
\php]
and my formhandler is:
[php
include("connect.php");
session_start();
require_once('common_functions.php');
$SESSION['form1_data'] = $POST;
// build main query from form 1
$sql = "INSERT INTO quality_info SET quality_id = NULL ";
foreach ($_SESSION['form1_data'] as $col =>$val ){
if($col <> 'submit'){
$sql .=", $col = '$val' ";
}
}
//////////////////////////////////
mysql_query($sql, $connection) or die(mysql_error());
//get last insert id
$sql ="select LAST_INSERT_ID() as id from quality_info";
$result = mysql_query($sql, $connection) or die(mysql_error());
$row=mysql_fetch_array($result);
$id = $row['id'];
\php]
I would like to be able to search for a record then have the form show with all the correspoding fields populated so they can be edited. Does this make sense?