views:

119

answers:

5

i have done one php project and i have uploaded it on server.I had devlopveped it on windowas and now i am trying to deploy it on remote linux server. But i am geting error. Some parts of page are not shown i donr know why? For example i have one page appply as follows . i can see only top part other parts i cant see.

<?php 
require 'inc/header.php';
require 'inc/config.php';
require 'inc/functions.php';



$QUERY0 = "
      SELECT *
            FROM states
          ";

       $result0 = send_query($QUERY0);
       $i=0;
       while($row = mysql_fetch_array($result0))
            {
                $states_names[$i]=$row['sname'];
                $states_val[$i] =$row['id'];
                $i++;

            }

$QUERY1 = "
      SELECT *
            FROM courses
          ";

       $result1 = send_query($QUERY1);
       $i=0;
       while($row = mysql_fetch_array($result1))
            {
                $courses_names[$i]=$row['cname'];
                $courses_val[$i]=$row['id'];
                $i++;

            }


$QUERY2 = "
      SELECT *
            FROM jobprofile
          ";

       $result2 = send_query($QUERY2);
       $i=0;
       while($row = mysql_fetch_array($result2))
            {
                $jobprofiles_names[$i]=$row['jobname'];
                $jobprofile_val[$i]=$row['jobid'];
                $i++;

            }



$QUERY3 = "
      SELECT *
            FROM edu
          ";

       $result3 = send_query($QUERY3);
       $i=0;
       while($row = mysql_fetch_array($result3))
            {
                $edu_names[$i]=$row['eduq'];
                $edu_val[$i]=$row['id'];


              //  echo "***********" .$edu_names[$i];
                $i++;

            }






?>

<div class="left">
    <div class="left_articles">

        <h2><a href="#">Register</a></h2>
        <p class="description">Please submit the folloing form</p>
        <p>
            <form action="check.php" method="post">

            <table border="0">

                <tbody>
                    <tr>
                        <td>First name</td>
                        <td><input type="text" name="fname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Last name</td>
                        <td><input type="text" name="lname" value="" /></td>
                    </tr>
                    <tr>
                        <td>Address</td>
                        <td><input type="text" name="address" value="" /></td>
                    </tr>

                    <tr>
                        <td>age</td>
                        <td><input type="text" name="age" value="" /></td>
                    </tr>

                    <tr>
                        <td>State of origin</td>
                        <td>
                            <select name="origin">
                                <?  $i=0;
                                    foreach( $states_names as $state )
                                    {

                                        $val=  $states_val[$i] ;
                                ?>
                                <option value="<? echo $val; ?>"><? echo $state; ?> </option>
                                <?
                                        $i++;
                                    }
                                ?>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td>Mobile no</td>
                        <td><input type="text" name="mobile" value="" /></td>
                    </tr>
                    <tr>
                        <td>Sex</td>
                        <td><select name="sex">
                                <option value="1">Male</option>
                                <option value="0">Female</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td>Marrital Status</td>
                        <td><select name="ms">
                                <option value="0">Single</option>
                                <option value="1">Married</option>
                        </select></td>
                    </tr>
                    <tr>
                        <td>Email</td>
                        <td><input type="text" name="email" value="" /></td>
                    </tr>
                    <tr>
                        <td>Job Applying For</td>
                        <td><select name="jobtype">
                                 <?  $i=0;
                                    foreach( $jobprofiles_names as $job )
                                    {

                                        $val=  $jobprofile_val[$i] ;
                                ?>
                                <option value="<? echo $val; ?>"><? echo $job; ?> </option>
                                <?
                                        $i++;
                                    }
                                ?>
                        </select>
                        </td>
                    </tr>

                    <tr>
                        <td>Have u worked in this sector before</td>
                        <td><select name="exp">
                                <option value="0">no</option>
                                <option value="1">yes</option>

                        </select></td>
                    </tr>
                    <tr>
                        <td>Which department of this sector u have worked?</td>
                        <td>    <input type="text" name="exptype" value="" />

                       </td>

                    </tr>
                    <tr>
                        <td>Years of experinece in this sector</td>
                        <td><input type="text" name="yrsexp" value="" /></td>
                    </tr>

                    <tr>
                        <td>Higest Educational qualification</td>
                        <td><select name="eduq">
                                <?  $i=0;
                                    foreach( $edu_names as $ed)
                                    {

                                        $val=  $edu_val[$i];
                              ?>
                                <option value="<? echo $val; ?>"><? echo $ed; ?> </option>
                               <?
                                        $i++;

                                    }
                               ?>
                        </select>

                        </td>
                    </tr>

                    <tr>
                        <td>Course taken in above educational qualification</td>
                        <td><select name="crc">

                              <?  $i=0;
                                    foreach( $courses_names as $crc)
                                    {

                                        $val=  $courses_val[$i];
                              ?>
                                <option value="<? echo $val; ?>"><? echo $crc; ?> </option>
                               <?
                                        $i++;

                                    }
                               ?>
                        </select>

                        </td>
                    </tr>

                    <tr>
                        <td>Grade obtained in the above educational qualification</td>
                        <td><select name="grade">
                                <option value="0">A</option>
                                 <option value="1">B</option>
                                  <option value="2">C</option>
                                   <option value="3">D</option>

                        </select>

                        </td>
                    </tr>


                    <tr>
                        <td></td>
                        <td><input type="submit" value="Apply now" /></td>
                    </tr>
                </tbody>
            </table>
            <input type="hidden" name="action" value="check" />
             </form>

        </p>
    </div>


</div>  



<?  require 'inc/right.php'  ?>

<?  require 'inc/footer.php'  ?>

my file description are as follows. header contains header righ.php contains right side of page

why are my pages not shown fully? does there is a problem with slash / postion ?? is it different on windows and linux?

+1  A: 

What do you mean by the "top parts"?

Also, try changing your php tags to explicitly label themselves as php, so

<?php ... ?>

instead of

<? ... ?>
Chris Thompson
+2  A: 

Are the files and directories for inc and inc/headers.php all lowercase in the filesystem? Unix filenames are case sensitive. Change the includes to require to see if it causes an error.

jmucchiello
+2  A: 

You should also check the line endings in all your files. If you developed on Windows, chances are pretty high that you have cr/lf line endings throughout your files, or even a mixed state. Depending on how you transferred the files to the Linux server, they might get converted or not. Especially a mixed state can cause trouble.

Another check would be the encoding of the files - these should also be consistent throughout your project. If they are in UTF-8, make sure that they don't have a Byte-order mark (BOM), as this can cause trouble with included files.

Henrik Opel
+1  A: 

You're experiencing Windows and Linux are handling relative paths differently.

Use absolute paths (note that php on both Windows and Linux both accept the forward slash directory separator).

Assuming (a Linux server example) your application is always executing from absolute path:

/home/www/index.php

And your include scripts are located:

/home/www/inc/header.php

...

Then you can define an absolute path and concatenate it to each include string:

<?php

define('ABSPATH', dirname(__FILE__));

...

include ABSPATH . '/inc/header.php';  

...

include ABSPATH . '/inc/footer.php';

?>
micahwittman
A: 

The DIRECTORY_SEPARATOR constant will help you here.

Replace:

require 'inc/header.php';

with:

require dirname(__FILE__) . DIRECTORY_SEPARATOR . 'inc' . DIRECTORY_SEPARATOR . 'header.php';

And do something similar for the rest.

patcoll