Jump to content

total code is not generating.


naveendk.55

Recommended Posts

Hi, I have created the below code.  The total score (showed in last line) should be 60 if all the questions are set to YES. I'm getting the data from a form. In form, I've labels and next to them, I created a drop down menu with YES NO and NA. However, after executing, the total score is showing as 0 and not 60 if all is set to YES. Any help is appreciated...

 

 

 

 

    <?php

    $question1 = $_REQUEST['Para_A_A1'];

    $question2 = $_REQUEST['Para_A_A2'];

    $question3 = $_REQUEST['Para_A_A3'];

    $question4 = $_REQUEST['Para_A_A4'];

    $question5 = $_REQUEST['Para_A_A5'];

    $question6 = $_REQUEST['Para_A_A6'];

   

    $numberofansweredquestions = 0;

    $score = 0;

 

    if ($question1 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question1 == "NO")

    {

        $numberofansweredquestions++;

    }

 

    if ($question2 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question2 == "NO")

    {

        $numberofansweredquestions++;

    }

   

    if ($question3 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question3 == "NO")

    {

        $numberofansweredquestions++;

    }

   

    if ($question4 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question4 == "NO")

    {

        $numberofansweredquestions++;

    }

   

    if ($question5 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question5 == "NO")

    {

        $numberofansweredquestions++;

    }

   

    if ($question6 == "YES")

    {

        $numberofansweredquestions++;

        $score += 10;

    }

    elseif ($question6 == "NO")

    {

        $numberofansweredquestions++;

    }

   

    $maxscore = $numberofansweredquestions * 10;

    echo "The score is: " . $score . "/" . $maxscore . "";

 

    ?>

 

Link to comment
https://forums.phpfreaks.com/topic/245102-total-code-is-not-generating/
Share on other sites

<html>

<head>

<title>Billing IE</title>

<link rel="stylesheet" type="text/css" href="upcstyle.css"/>

<script language="JavaScript" src="calendar_us.js"></script>

<link rel="stylesheet" href="calendar.css">

<script language="JavaScript">

<!--

 

/***********************************************

* Required field(s) validation Java script

***********************************************/

 

function formCheck(formobj){

// Enter name of mandatory fields

var fieldRequired = Array("agent_name", "DOI", "cust_name", "analyst_name", "cust_email", "date_monitoring", "activity_id", "total_score");

// Enter field description to appear in the dialog box

var fieldDescription = Array("Agent Name", "Date of Incident", "Customer Name", "Analyst Name", "Customer E-mail", "Date of Monitoring", "Activity ID", "Total Score");

// dialog message

var alertMsg = "Dear user, please complete the following fields:\n\n";

 

var l_Msg = alertMsg.length;

 

for (var i = 0; i < fieldRequired.length; i++){

var obj = formobj.elements[fieldRequired];

if (obj){

switch(obj.type){

case "select-one":

if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "select-multiple":

if (obj.selectedIndex == -1){

alertMsg += " - " + fieldDescription + "\n";

}

break;

case "text":

case "textarea":

if (obj.value == "" || obj.value == null){

alertMsg += " - " + fieldDescription + "\n";

}

break;

default:

}

if (obj.type == undefined){

var blnchecked = false;

for (var j = 0; j < obj.length; j++){

if (obj[j].checked){

blnchecked = true;

}

}

if (!blnchecked){

alertMsg += " - " + fieldDescription + "\n";

}

}

}

}

 

if (alertMsg.length == l_Msg){

return true;

}else{

alert(alertMsg);

return false;

}

}

// -->

</script>

 

 

<script type="text/javascript">

 

function startCalc(){

  interval = setInterval("calc()",1);

}

function calc(){

  a = document.commform.sen_con_score.value;

  b = document.commform.sub_arg_score.value;

  c = document.commform.spell_score.value;

 

  d = document.commform.punc_score.value;

  e = document.commform.add_score.value;

  f = document.commform.open_score.value;

 

  g = document.commform.close_score.value;

  h = document.commform.tone_score.value;

  i = document.commform.para_score.value;

  j = document.commform.cust_hist_score.value;

  k = document.commform.acknow_score.value;

  l = document.commform.third_party_score.value;

  m = document.commform.person_score.value;

  n = document.commform.script_score.value;

  o = document.commform.research_score.value;

 

 

 

 

  document.commform.grand_total.value = (a * 1) + (b * 1) + (c * 1) + (d * 1) + (e * 1) + (f * 1) + (g * 1)+ (h * 1) + (i * 1) + (j * 1) + (k * 1) + (l * 1) + (m * 1)  + (n * 1) + (o * 1)  ;

  document.commform.total_score.value = (a * 1) + (b * 1) + (c * 1) + (d * 1) + (e * 1) + (f * 1) + (g * 1)+ (h * 1) + (i * 1) + (j * 1) + (k * 1) + (l * 1) + (m * 1)  + (n * 1) + (o * 1)  ;

 

 

}

function stopCalc(){

  clearInterval(interval);

}

 

</script>

 

 

 

 

<script language="JavaScript" src="../JS/pupdate.js">

</script>

 

</head>

<body onload="startCalc();">

<form id="audit_billing_IE" name="audit_billing_IE" method="post" action="testphp.php" onSubmit="return formCheck(this);">

<div id="mainForm">

<div class="formFields">

 

<table style=\"width: 800px;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">

<tr>

<th colspan='4'> Billing </th>

</tr>

</div>

<div id="td">

<div class="upper">

<tr>

<td background-color="green"> Evaluator Name  </td>

<td> <input type="text" name=evaluator_name id="evaluator_name"/> </td>

</tr>

 

<tr>

<td> Agent Name </td>

<td> <input type="text" name=user_name id="user_name"/> </td>

</tr>

 

<tr>

<td> Processing Date </td>

<td>

 

<input type="text" name="processing_date" id="processing_date"/>

<script language="JavaScript">

new tcal ({

// form name

'formname': 'audit_billing_IE',

// input name

'controlname': 'processing_date'

});

 

</script>

</td>

</tr>

<tr>

<td> Review Date </td>

<td colspan="3">

 

<input type="text" name="review_date" id="review_date"/>

<script language="JavaScript">

new tcal ({

// form name

'formname': 'audit_billing_IE',

// input name

'controlname': 'review_date'

});

 

</script>

</td>

</tr>

 

<tr>

<td> Contact ID </td>

<td colspan='3'> <input type="text" name=contact_ID id="contact_ID"/> </td>

</tr>

 

<tr>

<td> Voice/Non Voice </td>

<td colspan='3'> <input type="text" name=audit_type id="audit_type"/> </td>

</tr>

 

<tr>

<td> A/C #/Case # </td>

<td colspan='3'> <input type="text" name=case_no id="case_no"/> </td>

</tr>

 

<tr>

<td> Product </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Call duration</td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Errors </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter A </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter B </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter C </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter D </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter E </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter F </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter G </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter H </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter I </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Parameter J </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

 

<tr>

<td> Total Possible Points for Audit </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Total Points Obtained for the Audit </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr>

<td> Assessment Score </td>

<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>

</tr>

 

<tr align="centre">

<th> <span style="color:white" BGcolor="Blue"><b> PARAMETERS </span> </th>

<th>  <span style="color:white"><b> TOGGLE </span> </th>

<th>  <span style="color:white"><b> COMMENTS </span></th>

<th>  <span style="color:white"><b> SCORES </span> </th>

</tr>

 

<tr>

<td colspan="4" bgcolor="CCCC66" align="left"> <b> A. Credit Request/Missing Promo/Credit approval </b> </td>

</tr>

 

<tr>

<td> Credit Procedure </td>

<td>

<select name=Para_A_A1 id = "Para_A_A1" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A1_comment id="Para_A_A1_comment"/>

</td>

 

<td align="center"> <input type="text" name=Para_A_A1_score id="Para_A_A1_score"/>

</td>

</tr>

 

<tr>

<td> Days Calculation (Service issue case)</td>

<td>

<select name=Para_A_A2 id = "Para_A_A2" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A2_comment id="Para_A_A2_comment"/>

</td>

 

<td> <input type="text" name=Para_A_A2_score id="Para_A_A2_score"/>

</td>

</tr>

 

<tr>

<td> Credit request form </td>

<td>

<select name=Para_A_A3 id = "Para_A_A3" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A3_comment id="Para_A_A3_comment"/>

</td>

 

<td> <input type="text" name=Para_A_A3_score id="Para_A_A3_score"/>

</td>

</tr>

 

<tr>

<td> Case closure </td>

<td>

<select name=Para_A_A4 id = "Para_A_A4" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A4_comment id="Para_A_A4_comment"/>

</td>

 

<td> <input type="text" name=Para_A_A4_score id="Para_A_A4_score"/>

</td>

</tr>

 

<tr>

<td> Comments / interaction </td>

<td>

<select name=Para_A_A5 id = "Para_A_A5" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A5_comment id="Para_A_A5_comment"/>

</td>

 

<td> <input type="text" name=Para_A_A5_score id="Para_A_A5_score"/>

</td>

</tr>

 

<tr>

<td> MIS updation </td>

<td>

<select name=Para_A_A6 id = "Para_A_A6" align="center">

<option value="Yes"> Yes </option>

<option value="No"> No </option>

<option value="NA"> NA </option>

 

</select>

</td>

 

<td >

<input type="text" name=Para_A_A6_comment id="Para_A_A6_comment"/>

</td>

 

<td> <input type="text" name=Para_A_A6_score id="Para_A_A6_score"/>

</td>

</tr>

 

</div>

 

 

</table>

<input name="submit" type="submit" id="submit" value="Submit Details" />

<input name="Reset" type="reset" value="Reset">

</form>

</div>

</div>

</body>

</body>

here we go...

<html>
<head>
<title>Billing IE</title>
<link rel="stylesheet" type="text/css" href="upcstyle.css"/>
<script language="JavaScript" src="calendar_us.js"></script>
<link rel="stylesheet" href="calendar.css">
<script language="JavaScript">
<!--

/***********************************************
* Required field(s) validation Java script
***********************************************/

function formCheck(formobj){
   // Enter name of mandatory fields
   var fieldRequired = Array("agent_name", "DOI", "cust_name", "analyst_name", "cust_email", "date_monitoring", "activity_id", "total_score");
   // Enter field description to appear in the dialog box
   var fieldDescription = Array("Agent Name", "Date of Incident", "Customer Name", "Analyst Name", "Customer E-mail", "Date of Monitoring", "Activity ID", "Total Score");
   // dialog message
   var alertMsg = "Dear user, please complete the following fields:\n\n";
   
   var l_Msg = alertMsg.length;
   
   for (var i = 0; i < fieldRequired.length; i++){
      var obj = formobj.elements[fieldRequired];
      if (obj){
         switch(obj.type){
         case "select-one":
            if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){
               alertMsg += " - " + fieldDescription + "\n";
            }
            break;
         case "select-multiple":
            if (obj.selectedIndex == -1){
               alertMsg += " - " + fieldDescription + "\n";
            }
            break;
         case "text":
         case "textarea":
            if (obj.value == "" || obj.value == null){
               alertMsg += " - " + fieldDescription + "\n";
            }
            break;
         default:
         }
         if (obj.type == undefined){
            var blnchecked = false;
            for (var j = 0; j < obj.length; j++){
               if (obj[j].checked){
                  blnchecked = true;
               }
            }
            if (!blnchecked){
               alertMsg += " - " + fieldDescription + "\n";
            }
         }
      }
   }

   if (alertMsg.length == l_Msg){
      return true;
   }else{
      alert(alertMsg);
      return false;
   }
}
// -->
</script>


<script type="text/javascript">

function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  a = document.commform.sen_con_score.value;
  b = document.commform.sub_arg_score.value; 
  c = document.commform.spell_score.value; 

  d = document.commform.punc_score.value;
  e = document.commform.add_score.value;
  f = document.commform.open_score.value;

  g = document.commform.close_score.value;
  h = document.commform.tone_score.value;
  i = document.commform.para_score.value;
  j = document.commform.cust_hist_score.value;
  k = document.commform.acknow_score.value;
  l = document.commform.third_party_score.value;
  m = document.commform.person_score.value;
  n = document.commform.script_score.value;
  o = document.commform.research_score.value;

        


  document.commform.grand_total.value = (a * 1) + (b * 1) + (c * 1) + (d * 1) + (e * 1) + (f * 1) + (g * 1)+ (h * 1) + (i * 1) + (j * 1) + (k * 1) + (l * 1) + (m * 1)  + (n * 1) + (o * 1)  ;
  document.commform.total_score.value = (a * 1) + (b * 1) + (c * 1) + (d * 1) + (e * 1) + (f * 1) + (g * 1)+ (h * 1) + (i * 1) + (j * 1) + (k * 1) + (l * 1) + (m * 1)  + (n * 1) + (o * 1)  ;
  
   
}
function stopCalc(){
  clearInterval(interval);
}

</script>




<script language="JavaScript" src="../JS/pupdate.js">
</script>

</head>
<body onload="startCalc();">
<form id="audit_billing_IE" name="audit_billing_IE" method="post" action="testphp.php" onSubmit="return formCheck(this);">
   <div id="mainForm">
      <div class="formFields">

      <table style=\"width: 800px;\" border=\"2\" cellspacing=\"2\" cellpadding=\"2\">
      <tr>
      <th colspan='4'> Billing </th>
      </tr>
      </div>
<div id="td">
<div class="upper">
<tr>
<td background-color="green"> Evaluator Name  </td>
<td> <input type="text" name=evaluator_name id="evaluator_name"/> </td>
</tr>

<tr>
<td> Agent Name </td> 
<td> <input type="text" name=user_name id="user_name"/> </td>
</tr> 

<tr>
<td> Processing Date </td> 
<td>

<input type="text" name="processing_date" id="processing_date"/>
   <script language="JavaScript">
   new tcal ({
      // form name
      'formname': 'audit_billing_IE',
      // input name
      'controlname': 'processing_date'
   });

   </script>
</td>
</tr>
<tr>
<td> Review Date </td> 
<td colspan="3">

<input type="text" name="review_date" id="review_date"/>
   <script language="JavaScript">
   new tcal ({
      // form name
      'formname': 'audit_billing_IE',
      // input name
      'controlname': 'review_date'
   });

   </script>
</td>
</tr>

<tr>
<td> Contact ID </td> 
<td colspan='3'> <input type="text" name=contact_ID id="contact_ID"/> </td>
</tr> 

<tr>
<td> Voice/Non Voice </td> 
<td colspan='3'> <input type="text" name=audit_type id="audit_type"/> </td>
</tr> 

<tr>
<td> A/C #/Case # </td> 
<td colspan='3'> <input type="text" name=case_no id="case_no"/> </td>
</tr> 

<tr>
<td> Product </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr> 

<tr>
<td> Call duration</td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr> 

<tr>
<td> Errors </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr> 

<tr>
<td> Parameter A </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter B </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter C </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter D </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter E </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter F </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter G </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter H </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter I </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Parameter J </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>


<tr>
<td> Total Possible Points for Audit </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Total Points Obtained for the Audit </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr>
<td> Assessment Score </td> 
<td colspan='3'> <input type="text" name=product_name id="product_name"/> </td>
</tr>

<tr align="centre">
<th> <span style="color:white" BGcolor="Blue"><b> PARAMETERS </span> </th>
<th>  <span style="color:white"><b> TOGGLE </span> </th>
<th>  <span style="color:white"><b> COMMENTS </span></th>
<th>  <span style="color:white"><b> SCORES </span> </th>
</tr> 

<tr>
<td colspan="4" bgcolor="CCCC66" align="left"> <b> A. Credit Request/Missing Promo/Credit approval </b> </td>
</tr>

<tr>
<td> Credit Procedure </td>
<td> 
<select name=Para_A_A1 id = "Para_A_A1" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A1_comment id="Para_A_A1_comment"/>
</td>

<td align="center"> <input type="text" name=Para_A_A1_score id="Para_A_A1_score"/>
</td>
</tr>

<tr>
<td> Days Calculation (Service issue case)</td>
<td> 
<select name=Para_A_A2 id = "Para_A_A2" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A2_comment id="Para_A_A2_comment"/>
</td>

<td> <input type="text" name=Para_A_A2_score id="Para_A_A2_score"/>
</td>
</tr>

<tr>
<td> Credit request form </td>
<td> 
<select name=Para_A_A3 id = "Para_A_A3" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A3_comment id="Para_A_A3_comment"/>
</td>

<td> <input type="text" name=Para_A_A3_score id="Para_A_A3_score"/>
</td>
</tr>

<tr>
<td> Case closure </td>
<td> 
<select name=Para_A_A4 id = "Para_A_A4" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A4_comment id="Para_A_A4_comment"/>
</td>

<td> <input type="text" name=Para_A_A4_score id="Para_A_A4_score"/>
</td>
</tr>

<tr>
<td> Comments / interaction </td>
<td> 
<select name=Para_A_A5 id = "Para_A_A5" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A5_comment id="Para_A_A5_comment"/>
</td>

<td> <input type="text" name=Para_A_A5_score id="Para_A_A5_score"/>
</td>
</tr>

<tr>
<td> MIS updation </td>
<td> 
<select name=Para_A_A6 id = "Para_A_A6" align="center">
<option value="Yes"> Yes </option>
<option value="No"> No </option>
<option value="NA"> NA </option>

</select>
</td>

<td >
<input type="text" name=Para_A_A6_comment id="Para_A_A6_comment"/>
</td>

<td> <input type="text" name=Para_A_A6_score id="Para_A_A6_score"/>
</td>
</tr>

</div>


</table>
<input name="submit" type="submit" id="submit" value="Submit Details" />
<input name="Reset" type="reset" value="Reset">
</form>
</div>
</div>
</body>
</body>

 

my eyes are burning...

 

also, there is no PHP in that code...

Archived

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

×
×
  • Create New...

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.