Re: Support
| From: | Hannes Magnusson | Date: | Tue, 13 Feb 2007 13:46:22 +0000 |
| Subject: | Re: Support | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-34283@lists.php.net to get a copy of this message | ||
Hi Wasantha
I am sorry but this is not a support forum, this is a mailing list for
the webmasters of php.net.
Please have a look at http://php.net/support for help
-Hannes
On 2/13/07, Wasantha De Silva <wasanthas@metropolitan.lk> wrote:
Dear Firend, I am doing development project for my final thesis. In one application of the HR system I want to get the KRA ( KEY RESULT AREA) in a form get the final grading at the end of the year. It is a dynamic (php) and javascript application only HTML part of it is working but the dynamic part is not working with the same javascript. Below is the script:This also inclues codes which are used for submission to the data to a table in the system. Please ignore that part and look for javascript. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- <?php session_start(); $empid =$_SESSION['epf_no'] ; $dbhost='localhost'; $dbuser='root'; $dbpass=''; $dbname='metrosite'; //static $v=0; static $v =0; $mess =''; if(isset($_POST["ADD"]) && v <=100){ $epf_no = $_POST["epf_no"]; $perf_area = addslashes($_POST["textarea"]); $weightage = $_POST["weight"]; $v += $weightage; $conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error()); mysql_select_db($dbname, $conn) or die (mysql_error ()); $query = "INSERT INTOkra_perf(S_No,Emp_No,Perf_Area,Weight) VALUES ( NULL , '$epf_no', '$perf_area', '$weightage')"; if(mysql_query($query,$conn)) { $mess= "Sucessfully entered"; } else { switch(mysql_errno($conn)){ case 1062 : echo "you have already entered please choose modify " ; break; default : echo (mysql_errno($conn)) ;}} } elseif(isset($_POST["update"])){ $s_no = $_POST["s_no"]; $textarea = $_POST["textarea"]; $weight = $_POST["weight"]; $conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error()); mysql_select_db($dbname, $conn) or die (mysql_error ()); $query = " UPDATEkra_perfSETPerf_Area= '$textarea',Weight= '$weight' WHERES_No= '$s_no' LIMIT 1 "; if(mysql_query($query,$conn)){ $mess = "Sucessfully updated"; } else { echo mysql_errno($conn); } } elseif(isset($_POST["Submit"])){ $epf = $_POST["epf_no"]; $act_grd = $_POST["act_grd"]; $act_pts = $_POST["act_pts"]; } elseif($v >100){ $mess ="TOTAL PERCENTAGE IS MORE THAN 100"; } elseif(isset($_POST['avg'])){ $conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error()); mysql_select_db($dbname, $conn) or die (mysql_error ()); $query = "SELECT SUM(Weight) AS weightage FROMkra_perfK GROUP BYEmp_NoWHERE K.Emp_No=1111 LIMIT 0 , 30;"; $row = mysql_query($query,$conn); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script language="javascript"> function Multiply(a,b,c){ i=0 alert(a); while(i<6){ if(b[i].selected) { c.value = Math.round(parseInt(parseInt(b[i].value)*(parseInt(a.value)/5)),1); //parseInt(window.document.option.value)*parseInt(window.document.test.enter.value); ////test.textfield.value } i++; } } </script> </head> <body> <form name="form1" method="post" action=""> <p> </p> <table width="198" border="2"> <tr><th scope="col"><font color="#0000FF">EPF No: </font></th> <th scope="col"><input name="epf_no" type="text" id="epf_no" size="4"></th></tr> </table> <p> </p> <table width="936" border="0"> <tr><th width="343" scope="col"> </th><?php if($mess!='') echo("<th width='317' bgcolor='#CCFF99' scope='col'><div align='center'><font color='#FF3333' size='4' face='Geneva, Arial, Helvetica, sans-serif'>".$mess."</font></div></th>"); ?><th width="262" scope="col"> </th></tr> </table> <p> </p> <table width="808" border="2"><tr> <th width="537" rowspan="4" scope="col"><textarea name="textarea" cols="70"></textarea></th> <th scope="col"> </th> <th scope="col"> </th> <th scope="col"> </th> </tr> <tr> <th scope="col"><font color="#0033CC">weightage %</font> </th> <th scope="col"> </th> <th scope="col"> </th> </tr> <tr> <th width="89" scope="col"><font size="3"><SPAN dir=ltr><B> <input name="weight" type="text" id="weight" value="0" size="3" maxlength="5" > </B></SPAN></font></th> <th width="60" scope="col"><font size="2"> <select name="act_grd" size="1" class="input_box" id="act_grd" onChange="" > <option value="5">5</option> <option value="4">4</option> <option value="3">3</option> <option value="2">2</option> <option value="1">1</option> </select></font></th><th width="92" scope="col"><input name="act_pts" type="text" id="act_pts" onClick="return Multiply(form1.weight,form1.act_grd,form1.act_pts)" value="0" size="4" maxlength="5"></th> </tr> <tr> <th scope="col"> </th> <th scope="col"><input name="ADD" type="submit" id="ADD" value="ADD"></th> <th scope="col"><input type="button" name="Button" value="getValue" onClick="return mul(form1.textfield1)"></th> </tr> <tr> <th scope="col"><font color="#990000">Enter Key Result Area</font></th> <th scope="col"> </th> <th scope="col"> </th> <th scope="col"><input type="submit" name="Submit" value="Submit"></th> </tr> <tr> <th scope="col"> </th> <th scope="col"> </th><th scope="col"> </th> <th scope="col"> </th> </tr></table> <p> </p> </form> <?php $conn = mysql_connect($dbhost,$dbuser,$dbpass)or die (mysql_error()); mysql_select_db($dbname, $conn) or die (mysql_error ()); //$sql="select * from kra_perf inner join kra_perf_value on kra_perf.Emp_No=kra_perf_value.Emp_No where kra_perf.Emp_No='1233'"; $query ="select * from kra_perf "; $row=mysql_query($query,$conn); $s=1; $count=1; echo("<form name='form' method='post' action=''>"); while($epf=mysql_fetch_array($row)) { $s_no = $epf["S_No"]; $v = $epf['Weight']; //echo("<form name='form".$s."' method='post' action=''>"); echo("<table width='75%' border='2'>"."<tr>"); echo("<th rowspan='2' scope='col'>"."<textarea name='textarea".$count."' cols='70'>".$epf['Perf_Area']."</textarea>"."</th>"); echo("<th scope='col'>"."<font size='3'>"."<SPAN dir=ltr><B>"); echo("<input name'=kra".$s."' type='text' value='$s_no' size='3' disabled>"); echo("<th scope='col'>"."<font size='3'>"."<SPAN dir=ltr><B>"); echo("<input name='$s' type='text' id='weight' value='$v' size='3' maxlength='5' >"."</B></SPAN></font></th>");//print("<input name='ProdList' id='". $count."' type='text' ");echo("<th scope='col'>"."<font size='3'>"."<SPAN dir=ltr><B>"); echo("<th scope='col'><font size='2'>"."<select name='act_grd".$s."' size='1' class='input_box' id='act_grd'>"); $i=5;while($i>0) { echo("<option value='$i'>".$i."</option>"); $i--; $count++; } echo("</select></font></th>"); //print("<input name='ProdList' id='". $count."' type='text' value='hi' onChange=\"javascript:selectProduct(this.name,this.value)\"><br>"); // echo("<td><input name='act_pts' type='text' size='4' onChange='javascript:selectProduct(this.value,'".$s."')'>"); echo("</td>"); echo("<td>"); echo("<input type='text' name='final".$s."' size='3' onClick='javascript:Multiply(document.form.kra".$s.",document.form.act_grd".$s.",document.form.final".$s.")' >"); echo("</td>"); echo("<td>"); // echo("<a href='KraUpdate.php?sno=200'>update</a>"); echo("<a href='KraUpdate.php?sno=$s_no'>update</a>"); // echo("<input type='submit' value='update' name='update'></input>"); echo("</td>"); echo("</tr>"); echo("<table>"); $s++; } echo("</form>"); /*echo("<form>"); echo("<table width='75%' border='2' align='left'>"); echo("<tr>"); echo("<td ><div align='left'>"); echo("Total percentage "); echo("<input type='text' onClick='return calculate();' ></div>"); echo("</td>"); echo("<td><div align='left'>"); echo("Total Aversage point ");echo("<input name='s_no' type='text' ></div>");echo("</td>"); echo("</tr>"); echo("</form>"); */ ?> <p> </p> <form name="form2" method="post" action=""><table width="1005" border="0"> <tr> <th width="194" scope="col"><input name="avg" type="submit" id="avg" value="Total Avg Points"></th> <th width="162" scope="col"><input type="text" name="textfield"></th> <th width="113" scope="col"><input type="submit" name="Submit" value="Total Percentage"></th> <th width="194" scope="col"><input type="text" name="textfield"></th> <th width="93" scope="col"><input type="submit" name="Submit" value="Save"></th> <th width="223" scope="col"> </th> </tr> <tr> <td> </td> <td> </td> <td colspan="4"> </td> </tr> </table></form> <p><a href="KraUpdate.php?sno=233">update</a></p> <p> </p> <p> </p> <p> </p> <p> </p> </body> </html> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- Can you help me please. Tks wasantha