redface
redface

Reputation: 325

php file is working on local server but fails when on online server

I did complete a website for online Entrance form for students as my demo project to learn. When I run from my local server it works fine but when I uploaded on webserver and tasted index.php and other files run fine except when user enter his/her symbol no to check if he/she already been registered or not..I have coded a logic

if (exists)>Show admit card if(don't exist)>show alert box

It works fine in local server but in webserver when I enter value in search box and enter then it shows empty page with no any error.

I have one row in my database. So in case you wanna check here is the symbol no in column =15369-2017-02 . On Entering submit it should show admit card and you can enter any random value other then this .which should show alert box.

Here is my website

https://cmprc.edu.np/condensed/entrance_form_demo/studntreport/main/

This is the code of file which is not responding and showing blank

    <html>
    <head>
    <title>
CDP || Admission Form
    </title>

     <link href="css/bootstrap.css" rel="stylesheet">
    <link href="../style.css" media="screen" rel="stylesheet" type="text/css" />


    <body style="background-color: white;">






   <?php
      include('../connect.php');
    $var_value = $_POST['search_value'];
    echo $var_value;

    $sql="SELECT * FROM entrance WHERE re_value='$var_value'";
    $STH = $db->prepare($sql);
    $STH->execute(array($var_value));
    $User = $STH->fetch();

    if (empty($User))

      echo "<script>alert('Sorry, you Have not Registered yet');
            window.location = 'index.php';</script>"; 
    else
            $result = $db->prepare("SELECT *  FROM entrance
                                    WHERE re_value = '$var_value' ORDER BY id ASC;");
            $result->execute();
            for($i=0; $row = $result->fetch(); ){

          ?>


    <link href="../style.css" media="screen" rel="stylesheet" type="text/css" />
    <center><h4><i class="icon-edit icon-large"></i> You've Already Registered</h4></center>
    <hr>




    <center>

      <div class="panel panel-default">
    <div class="container">
      <div class="row">
        <div class="col-md-4 seventy">
           <img src="img/admit.png"/ >

        </div>

        <div class="col-md-8 thirty">

      <img src="../image/profile/<?php echo $row['pic_value'];?>" class="roundimage2"   alt=""/>
    </div>
      </div>
    </div>


    <hr>
    <table style=" width: 500px;">

      <tr>
    <td >Roll no: </td>
    <td> <?php echo $row['id']; ?></td>
      </tr>

    <tr>
    <td >Name : </td>
    <td > <?php echo $row['name_en_value']; ?></td>


    <td > Subject:  </td>
    <td > <?php echo $row['ge_value']; ?> </td>
     </tr>
    </table>

    <br><br>
    <h5><i><strong>STUDENTS MUST BRING THIS ADMIT CARD ON THE DAY OF EXAMINATION</strong></i></h5>

    <br>
  </div>
  </center>


    <?php
    }
    ?>

    </body>
    <?php include('footer.php');?>

    </html>

Any help? I did almost finished it which I was working continously for 4-5 Days.

Upvotes: 1

Views: 479

Answers (1)

Tim S
Tim S

Reputation: 191

It seems that your php is not executed correctly. Maybe try to enable error reporting to get a hint of what's wrong.

Include the following at the beginning of your destination file (my.php)

<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);

Upvotes: 2

Related Questions