I had a fully operable scoring system which worked fine but now it doesn't. From the extract below you will see that the exported results should display a list of quality systems with scores that run in the thousands. instead the score is zero fall qualoty systems. Can anyone see why as this is driving me up the wall.
formhandler.php
<?php
include("include/session.php");
include("connect.php");
$username = $_SESSION['username'];
if (isset($_POST['submit'])) {
$answer = array();
$answer[1] = $_POST['time'];
$answer[2] = $_POST['demand'];
$answer[3] = $_POST['external_support'];
$answer[4] = $_POST['training'];
$answer[5] = $_POST['complexity'];
$answer[6] = $_POST['depth'];
$answer[7] = $_POST['partuse'];
$answer[8] = $_POST['cost'];
$answer[9] = $_POST['orgwhole'];
$answer[10] = $_POST['external_validated'];
$sql = "UPDATE qualityuser SET time = '$answer[1]',
demand = '$answer[2]',
external_support = '$answer[3]',
training = '$answer[4]',
complexity = '$answer[5]',
depth = '$answer[6]',
partuse = '$answer[7]',
cost = '$answer[8]',
orgwhole = '$answer[9]',
external_validated = '$answer[10]'
WHERE username = '$username'";
mysql_query($sql) or exit(mysql_error());
}
function pqasso($answer)
{
$pqasso_score = 0;
//time needed
if ($answer[1] == "Standards achievable in under 6 months") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[1] == "Standards achievable in under 12 months") {$pqasso_score = $pqasso_score - 0;}
if ($answer[1] == "Neither important nor unimportant – longer time is okay or preferred") {$pqasso_score = $pqasso_score - 0;}
//demand on staff time
if ($answer[2] == "Standards achievable without high involvement of all staff") {$pqasso_score = $pqasso_score - 0;}
if ($answer[2] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[2] == "Process of working towards standards needs active involvement of most/all staff") {$pqasso_score = $pqasso_score - 0;}
//need for external support
if ($answer[3] == "Standards achievable without needing significant support from external agency") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[3] == "Preference for Standards where specific support is available and expected ") {$pqasso_score = $pqasso_score - 0;}
if ($answer[3] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score - 0;}
// level of training
if ($answer[4] == "Standards achievable without training") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[4] == "Some training requirement expected and acceptable") {$pqasso_score = $pqasso_score - 0;}
if ($answer[4] == "Significant training requirement expected and acceptable") {$pqasso_score = $pqasso_score - 0;}
// complexity
if ($answer[5] == "Vital for standards to be straight-forward and easy to grasp") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[5] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score - 0;}
if ($answer[5] == "The need to get to grips with unfamiliar framework and concepts is acceptable") {$pqasso_score = $pqasso_score - 0;}
if ($answer[5] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score - 0;}
//relevance to voluntary sector
if ($answer[6] == "Desirable to be well-used & adapted to voluntary sector use") {$pqasso_score = $pqasso_score - 0;}
if ($answer[6] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score + 500;}
if ($answer[6] == "Essential to be well-used and adapted to voluntary sector use") {$pqasso_score = $pqasso_score + 1000;}
//facility for part use
if ($answer[7] == "Essential to be able to use selectively") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[7] == "Desirable to be used selectively") {$pqasso_score = $pqasso_score - 0;}
if ($answer[7] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score - 0;}
// cost
if ($answer[8] == "Low cost essential" || "Low cost desirable" ) {$pqasso_score = $pqasso_score + 1000;}
if ($answer[8] == "Neither important nor unimportant") {$pqasso_score = $pqasso_score - 0;}
if ($answer[8] == "Reasonable costs budgeted for") {$pqasso_score = $pqasso_score - 0;}
//looks at organisation as whole
if ($answer[9] == "Essential for standards to cover quality in all aspects of an organisation" || "Desirable for standards to cover quality in all aspects of an organisation") {$pqasso_score = $pqasso_score + 1000;}
if ($answer[9] == "Chosen standards can be used purely for specific projects or functions within organisation’s") {$pqasso_score = $pqasso_score - 0;}
//is externally validated
if ($answer[10] == "Essential" || "Desirable") {$pqasso_score = $pqasso_score - 0;}
if ($answer[10] == "Preferably not" || "Neither important nor unimportant") {$pqasso_score = $pqasso_score + 1000;}
return $pqasso_score;}
//functions for each system follow the same format as above but there are too many to show!!
//convert functions to vars
$pqasso_result = pqasso($answer);
$iip_result = iip($answer);
$iso_result = iso($answer);
$excel_result = excel($answer);
$social_result = social($answer);
$qmark_result = qmark($answer);
$chmark_result = chmark($answer);
$qfirst_result = qfirst($answer);
$balanced_result = balanced($answer);
$bigpic_result = bigpic($answer);
//insert scores
if (isset($_POST['submit'])) {
include "connect.php";
$username = $_SESSION['username'];
$scorearray[1] = $pqasso_result;
$scorearray[2] = $iip_result;
$scorearray[3] = $iso_result;
$scorearray[4] = $excel_result;
$scorearray[5] = $social_result;
$scorearray[6] = $qmark_result;
$scorearray[7] = $chmark_result;
$scorearray[8] = $qfirst_result;
$scorearray[9] = $balanced_result;
$scorearray[10] = $bigpic_result;
$qualitysystem[1] = "PQASSO";
$qualitysystem[2] = "Investors in People";
$qualitysystem[3] = "ISO Standards";
$qualitysystem[4] = "Excel";
$qualitysystem[5] = "Social Audit";
$qualitysystem[6] = "Quality Mark";
$qualitysystem[7] = "Charter Mark";
$qualitysystem[8] = "Quality First";
$qualitysystem[9] = "Balanced Scorecard";
$qualitysystem[10] = "Big Picture";
$searchurl[1] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=PQASSO";
$searchurl[2] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=IIP+(Investors+in+People)";
$searchurl[3] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=ISO+Standards";
$searchurl[4] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=EFQM+Excellence+Model+(European+Foundation+for+Quality+Management)";
$searchurl[5] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Social+Accounting+and+Audit";
$searchurl[6] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=CLS+Quality+Mark+(Community+Legal+Services)";
$searchurl[7] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Charter+Mark";
$searchurl[8] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Quality+First";
$searchurl[9] = "http://www.mindseyemidlands.co.uk/notts_quality/info_resource/qualitysystem_complete_details.php?quality_name=Balanced+Scorecard";
$searchurl[10] = "Big Picture";
$values = array();
foreach($scorearray as $key => $score)
{
// each element will be a parenthesized list of values:
$values[] = sprintf("('%s','%s',%d,'%s')", $username, $qualitysystem[$key], $score, $searchurl[$key]);
}
// merge values into sequence of comma-separated value lists:
$valueList = implode(',', $values);
// create the SQL:
$sql = "INSERT INTO `qualityuserscores` (`username`, `qualitysystem`, `score`, `search_url`) VALUES $valueList";
$result = mysql_query($sql) or exit(mysql_error());
}
header("Location: http://www.mindseyemidlands.co.uk/notts_quality/info_resource/selfassess_part2b_v1.php");
?>
selfassess_part2b_v1.php
include "include/session.php";
$username = $_SESSION['username'];
<?php
$sql = "SELECT * FROM qualityuserscores WHERE username = '$username' ORDER BY score DESC";
$result = mysql_query($sql) or die(mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
echo '
<TABLE BORDER=1 CELLPADDING=2>
<TR> <TH COLSPAN=2 BGCOLOR="#99CCFF"></TH> </TR>
<TR> <TD WIDTH=400><a href="' . $row['search_url'] . '">' . $row['qualitysystem'] . '</a></TD> <TD WIDTH=250>' . $row['score'] . '</TD> </TR>
</TR>
</TABLE>';
}
}
?