//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";
 }       

}
Member Avatar for diafol

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.