-1

Hello Guys, My Codes to TextBox Validation Not Properly Working. I tried all as i can but still no happen. can you check my codes where the part is wrong?

<!DOCTYPE html>
<?php 
    include('dbcon.php');
    session_start();
?>
<HTML>
<HEAD>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Online Evaluation</title>
    <!-- Bootstrap -->
    <link href="css/style.css" rel="stylesheet">
    <link href="css/form.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <SCRIPT language="javascript">
        function addRow(tableID) {

            var table = document.getElementById(tableID);

            var rowCount = table.rows.length;
            var row = table.insertRow(rowCount);

            var colCount = table.rows[0].cells.length;

            for(var i=0; i<colCount; i++) {

                var newcell = row.insertCell(i);

                newcell.innerHTML = table.rows[0].cells[i].innerHTML;
                //alert(newcell.childNodes);
                switch(newcell.childNodes[0].type) {
                    case "text":
                            newcell.childNodes[0].value = "";
                            break;
                    case "checkbox":
                            newcell.childNodes[0].checked = false;
                            break;
                    case "select-one":
                            newcell.childNodes[0].selectedIndex = 0;
                            break;
                }
            }
        }

        function deleteRow(tableID) {
            try {
            var table = document.getElementById(tableID);
            var rowCount = table.rows.length;

            for(var i=0; i<rowCount; i++) {
                var row = table.rows[i];
                var chkbox = row.cells[0].childNodes[0];
                if(null != chkbox && true == chkbox.checked) {
                    if(rowCount <= 1) {
                        alert("Cannot delete all the rows.");
                        break;
                    }
                    table.deleteRow(i);
                    rowCount--;
                    i--;
                }


            }
            }catch(e) {
                alert(e);
            }
        }

    </SCRIPT>
</HEAD>
<BODY>

<nav class="alert-warning header_nav navbar navbar-default navbar-static-top" role="navigation">
  <div class="container-fluid navbar-static-top">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="index.php">Online Evaluation</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#myModal" role="button" class="btn" data-toggle="modal">Click Here for Instruction</a></li>


<?php
@$member_id=$_SESSION['id'];
if (isset($_SESSION['id']))
{

        $result1=mysql_query("select * from user where id='$member_id'")or die(mysql_error);
        $row1 =mysql_fetch_array($result1);
        $username1 =$row1['UserName'];
        $FullName1=$row1['FullName'];
        $image_name1 = $row1['img_name'];
        $email1= $row1['Email'];
        if ($image_name1 !== 'default'){
                echo "<li class='dropdown'>
                  <a href='#' class='dropdown-toggle' data-toggle='dropdown'><img src='view_img.php' class='img_responsive' width='25' height='25'>&nbsp;My Account <b class='caret'></b></a>
                  <ul class='dropdown-menu'>
                    <li><a href='account.php'><b>$FullName1</b></a></li>
                    <li><a href='logout.php'>Log-out</a></li>
                  </ul>
                </li>";

                }
                else{
                    $handle = opendir(dirname(realpath(__FILE__)).'/img/');
                    while($file = readdir($handle)) {
                        if($file == 'default.png') {
                        echo "<li class='dropdown'>";
                            echo "<a href='#' class='dropdown-toggle' data-toggle='dropdown'>";echo '<img src="img/'.$file.'" class="img_responsive" width="25" height="25" >'; echo "&nbsp;My Account <b class='caret'></b></a>";
                            echo"<ul class='dropdown-menu'>
                                <li><a href='account.php'><b>$FullName1</b></a></li>
                                <li><a href='logout.php'>Log-out</a></li>
                              </ul>";
                        echo "</li>";
                        }
                    }
                }

}
else{
if (isset($_SESSION['loged']) && ($_SESSION['loged'] == false   ))
{

}
?>
        <li><a href="register.php" role="button" class="btn">Register</a></li>
        <li><a href="login.php" role="button" class="btn">Login</a></li>
<?php
}
?>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>
<div class="star">
            <div class="star col-md-12">
            <div id="myModal" class="modal fade">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h3 class="modal-title"><img src="img/images.jpg" width="60" height="60" />ESPC PERFORMANCE APPRAISAL SYSTEM</h3>
                  </div>
                  <div class="modal-body">
                    <p><b>Direction:</b> The ESPC performance appraisal uses a five-point rating (likert) scale. This technique provides an effective method for measuring employee performance through the use of both qualitative and quantitative criteria.</p>
                    <p>In this performance appraisal technique, 5 will be considered as the highest or the most favorable and 1 will be the considered as the lowest or least favorable.</p>
                    <p>Below is the general rating reference table to be used as a guide in rating ESPC employees. You may also use the Qualitative and Quantative sheet for items that may not be rated using the table below. Appraising officers can put <b>NA (Not Applicable)</b> for some items that cannot be rated.</p>
                    <h4>ESPC General Rating Reference Table</h4>

                <table border="1px">
                    <tr>
                        <th>SCALE VALUE</th>
                        <th>DESCRIPTION</th>
                        <th>DETAILED INFORMATION</th>
                    </tr>
                    <tr>
                                <td><h5>1</h5></td>
                                <td><h4>Unsatisfactory Performance:</h4></td>
                                <td><p>Performance must improve substantially within a reasonable period of time if the individual is to remain in this position. The employee is not meeting the job requirements.</p></td>
                    </tr>    
                    <tr>
                                <td><h5>2</h5></td>
                        <td><h4>Needs Development:</h4></td>
                                <td><p>Performance is noticeably less than expected. The employee generally meets most job requirements, but struggles to fully meet them all. The need for further development and improvement is clearly recognized.</p></td>
                    </tr>    
                    <tr>
                                <td><h5>3</h5></td>
                        <td><h4>Meets Expectations:</h4></td>
                                <td><p>Performance clearly and fully meets all the requirements of the position in terms of quality and quantity of work. It is described as good, solid performance, with thorough and on-time results. While minor deviations may occur, the overall level of performance meets all position requirements.</p></td>
                    </tr>    
                    <tr>
                                <td><h5>4</h5></td>
                        <td><h4>Exceeds Expectations:</h4></td>
                                <td><p>Performance clearly and exceeds all the requirements of the position in terms of quality and quantity of work. It is described as excellent, solid performance, with thorough and on-time results. The overall level of performance exceeds all position requirements.</p></td>
                    </tr>    
                    <tr>
                                <td><h5>5</h5></td>
                        <td><h4>Exceptional Performance:</h4></td>
                                <td><p>Performance levels and accomplishments far exceed normal expectations. This category is reserved for the employee who truly stands out and clearly and consistently demonstrates exceptional accomplishments in terms of quality and quantity of work that is easily recognized as truly exceptional by others.</p></td>
                    </tr>    

                </table>


                    </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                  </div>
                </div><!-- /.modal-content -->
              </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->    
        </div>
    </div>
<div class="container">

        <div class="jumbotron">
            <h2>Welcome Admin to Form Generator</h2>
            <p>Create and Modify your Evaluation Form</p>
        </div>

<div class="col-md-12 col-sm-12">


    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" name="form1">

    <table class="rating" border="1">
    <tr>
            <th style="text-align:center;width:35px;"></th>
            <th style="text-align:center;width:220px;">CORE VALUES</th>
            <th style="text-align:center;width:615px;">BEHAVIORAL DESCRIPTION</th>
            <th style="text-align:center;width:210px;">PERCENTAGE</th>
    </tr>
    </table>

    <TABLE id="dataTable" class="rating" border="1">

    <form method="POST" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" name="form1">

        <TR>
            <TD><INPUT type="checkbox" name="chk[]"/></TD>

            <TD class="rating">
<?php
if(isset($_POST['submit']))
{
    $core_values = $_POST["core_values"];
    $behavioral1 = $_POST["behavioral1"];
    $rating = $_POST["rating"];
            $array =  $core_values;
            $array1 =  $behavioral1;
            $array2 =  $rating;
if ($_SERVER["REQUEST_METHOD"] == "POST")
{

            if(empty($_POST['core_values']) == true){
            echo "<div class='alert alert-danger'>Check Your Criteria</div>";
            }

            else{
            echo "<div class='alert alert-success'>Success</div>";
            }
}
}
?>
            <INPUT type="text" PlaceHolder="Criteria Here" size="9" name="core_values[]"/></TD>
            <TD>
            <textarea name="behavioral1[]" style="text-align:left;resize: none;" cols="76" rows="4" height="auto" PlaceHolder="Description Here"></textarea>
            </TD>
            <td class="rating"><input type="text" PlaceHolder="Percentage" maxlength="1" max="5" id="rate" name="rating[]" size="9"></td>
        </TR>
    </TABLE>

    </br>
    <INPUT type="submit" name="submit" class="pull-right btn-warning" value="CREATE" />
    </form>
     <INPUT type="button" class="btn-warning" value="Add Row" onclick="addRow('dataTable')" />
    <INPUT type="button" class="btn-warning" value="Delete Row" onclick="deleteRow('dataTable')" />
    </form>
</div>
</div>
    </br>

        <div class="clearfix"></div>
        <div class="clearfix"></div>
        <div class="clearfix"></div>
        <div class="clearfix"></div>  
    </div>
    <div class="clearfix"></div>
    <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
  </body>
</html>

tnx in advance. i am not good in php. Sorry for being stupid.

2
Contributors
1
Reply
12
Views
3 Years
Discussion Span
Last Post by Excizted
0

Please improve your post and I will gladly help.

You should always make it as easy for someone to help you, if you want them to answer your question - for free after all.

Important things we want to know:

  • What are you expecting to happen (how should it work)?
  • What happened instead (what's the problem)?

You are posting 286 lines of code and markup language without in any way hinting where you are having trouble. Including the full code may be useful, but you should point out the significant parts.

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.