0
//how can i  use a0,a1,a2 in a loop in php code.


//this is my program please help
//also onclick event is not working to call aphp function


 <input type="radio" name="a<?php echo $i;?>" value="average" onclick="if(this.checked) {
                                 this.form.a.style.visibility='hidden';
                                 } else {
                                  this.form.a.style.visibility='visible';}">average
<input type="radio" name="a<?php echo $i;?>" value="excellent">excellent<br>
<input type="radio" name="a<?php echo $i++;?>" value="poor">poor

if(isset($_POST['onsub'])){


     //for(){
                 $t=$_REQUEST['a<?php $i>']; 
                switch ($t){
                      case "good":
                                   $q2 = "update teacher set good=good+1 where teacher_name='$tname'";
                                     $r = mysql_query($q2, $con);
                                        if (!$r)
                                        echo "error";
                                        break;
                      case "average":
                                    $q2 = "update teacher set average=average+1 where teacher_name='$tname' ";
                                    mysql_query($q2, $con);
                                    break;
                      case "excellent":
                                    $q2 = "update teacher set excellent=excellent+1 where teacher_id='$tname'";
                                    mysql_query($q2, $con);
                                    break;
                     default:
                                    echo "please select one";
 }       

}

Edited by Dani: Formatting fixed

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by diafol
0

You can start by using code tags. Onclick calls javascript not php. You need to use Ajax if you want to run a php script.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.