This is so odd- I have renamed $SESSION['formdata2'] to $SESSION['formdata1'] as there is form completed earlier on and this time the results are:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Low,Low,Self assessment,Low,Low,Low,Yes,Low,Yes,Yes,submit WHER
This makes me think that $_SESSIOn['formdata'] is being passed as you can see the values listed: Low,Self assessment,Low,Low,Low,Yes,Low,Yes,Yes,submit
To help the case here is an overview of the other form I referred to which works just fine- notice im using exactly the same syntax bar the UPDATE procedure.
<?php
include("include/session.php");
$_SESSION['formdata1']='';
$username = $_SESSION['username'];
include("connect.php");
// query
$sql = "SELECT * FROM qualityuser WHERE username = '".$username."'";
$result = mysql_query($sql);
// if we have rows, fetch them & prepopulate the form
if(mysql_num_rows($result) > 0) {
$row = mysql_fetch_array($result);
} else {
$row = array('firstname'=>'','secondname'=>'','organisation'=>'','telephone'=>'','address1'=>'','address2'=>'','town'=>''
,'postcode'=>'' ,'registeredcharity'=>'','incorporated'=>'','regionalassociation'=>'','regionalcharity'=>'','project'=>''
,'nature_selfhelp'=>'','nature_frontline'=>'','nature_intermediary'=>'','nature_infrastructure'=>'','nature_partnership'=>''
,'involved_commitee'=>'','involved_volunteers'=>'','involved_paid'=>'','funded_unrestrictedfunds'=>'','funded_localcouncil'=>''
,'funded_undercontract'=>'','funded_grants_fees'=>'','funded_socialenterprise'=>'','activity_care'=>'','activity_advice_individual'=>''
,'activity_advice_organisations'=>'','activity_specialist'=>'','activity_community'=>'','activity_awareness'=>'','activity_sport'=>''
,'activity_mutual_support'=>'','have_policies_procedures'=>'','have_management_structure'=>'','have_communication'=>'','have_supervision'=>''
,'have_strategy'=>'','have_aims'=>'','have_review'=>'');
}
?>
/////and then the form
input name="firstname" type="text" id="firstname" value="<?=$row['firstname']?>" size="40"></td>
////etc////
and the formhandler for it
<?php
include("include/session.php");
$_SESSION['formdata1']=$_POST;
include("connect.php");
//array to hold form errors
$form_error = array();
//validate your form data
if(!isset($_POST['firstname'])){
$form_error[] = "No first name entered";
}
if(!isset($_POST['secondname'])){
$form_error[] = "No second name entered";
}
if(count($form_error) > 0){
//hold the error in session so you can display the error in your form page.
$_SESSION['form_error'] = $form_error;
//redirect to the form
header("Location: http://www.mindseyemidlands.co.uk/notts_quality/info_resource/selfassess_part1a_v1.php");
} else {
$username = $_SESSION['username'];
// build main query from form part 1
$sql = "INSERT INTO qualityuser SET qualityuser_id = NULL ";
foreach ($_SESSION['formdata1'] as $col =>$val ){
if($col <> 'submit'){
$sql .=", $col = '$val' ";
}
}
mysql_query($sql, $connection) or die(mysql_error());
//remove the form_error session
unset($_SESSION['form_error']);
[/code]