Page 1 of 1

form forward issue. Need help

Posted: Mon Aug 22, 2011 6:48 am
by naveendk.55
Hi, I created a form and the trying to forward it to testphp.php. However, it is forwarding but not displaying the score according to the drop down test. If I set any of drop down option to No, then 10 must minus from the total. However, the output is always zero irrespective of the input.

Code: Select all


<html>
<head>
<title>Billing IE</title>


</head>
<body >
<form id="audit_billing_IE" name="audit_billing_IE" method="post" action="testphp.php">
	
<table> 
<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"/>
	
 </td>
</tr>
<tr>
<td> Review Date </td> 
<td colspan="3">

<input type="text" name="review_date" id="review_date"/>
	
 </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_name1 id="product_name"/> </td>
</tr> 

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

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

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

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

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

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

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

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

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

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

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

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


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

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

<tr>
<td> Assessment Score </td> 
<td colspan='3'> <input type="text" name=product_name16 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 approval </b> </td>
</tr>

<tr>
<td> 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 </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> 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> TEXT 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>


<tr> 
    

<td> <input name="submit" type="submit" id="submit" value="Submit Details" />
<input name="Reset" type="reset" value="Reset">
</td> 
</tr> 
</div>

</table>

</form>
</div>
</div>
</body>
</html> 

Below is the testphp.php

Code: Select all


<?php
    $question1 = $_POST['Para_A_A1'];
    $question2 = $_POST['Para_A_A2'];
    $question3 = $_POST['Para_A_A3'];
    $question4 = $_POST['Para_A_A4'];
    $question5 = $_POST['Para_A_A5'];
    $question6 = $_POST['Para_A_A6'];
    
    {
    $numberofansweredquestions = 0;
    $score = 0;

    if ($question1 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if 
            ($question1 == "NO")
    {
         $numberofansweredquestions++;
    }

    if ($question2 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if
            ($question2 == "NO")
    {
         $numberofansweredquestions++;
    }
    
     if ($question3 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if 
            ($question3 == "NO")
    {
         $numberofansweredquestions++;
    }
    
     if ($question4 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if 
            ($question4 == "NO")
    {
         $numberofansweredquestions++;
    }
    
     if ($question5 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if 
            ($question5 == "NO")
    {
         $numberofansweredquestions++;
    }
    
     if ($question6 == "YES")
    {
         $numberofansweredquestions++;
         $score += 10;
    }
    else
        if 
            ($question6 == "NO")
    {
         $numberofansweredquestions++;
    }
    
    $maxscore = $numberofansweredquestions * 10;
    echo "The score is: " . $score . "/" . $maxscore . "";
    
    }
    
    ?>




Re: form forward issue. Need help

Posted: Mon Aug 22, 2011 11:39 am
by social_experiment

Code: Select all

<input type="text" name=evaluator_name id="evaluator_name"/>
<!-- just a note on the html syntax, it should be -->
<input type="text" name="evaluator_name" id="evaluator_name" />

As to the php section, your html values are 'Yes', 'No' and 'NA' but you test for "YES" and "NO". You have two options:

Code: Select all

<?php
 // option 1
 $question1 == 'Yes';
 // option 2
 $question1 = strtolower($question1);
 $question1 == 'yes';
?>
Test for the exact value as in your form, or you can manipulate the value you receive from the form and test that.

Re: form forward issue. Need help

Posted: Mon Aug 22, 2011 12:04 pm
by naveendk.55
Thanks for your help. That info helped me and resolved it. Thank again.