Re: PHP5.3 -> PHP7.0 Forms targeting a handler in the php dir work but not if using an include file in current dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 15/09/2021 10:22, Bo Berglund wrote:
I am working to debug PHP code that was written using PHP 5.3 and which is now
misbehaving when the webserver switched to PHP 7.0.

In htdocs/php I have the bulk of the php main code and in some other paths I
have forms that use the php common code.

Each form that uses the system has a form handler *locally* where it is stored
so the form code looks like this example:

<form action="dbtest.php" method="POST">
   <table border="0">
      <tr>
        <td align="right"><b>* Table Name</b></td>
        <td><input type="text" size="50" name="dbtable"></td>
      </tr>
    </table>
   <p> <input name="submit" type="submit" value="Show Table Data">
	<input type="reset" value="Reset"> </p>
</form>

The dbtest.php file looks like this and resides in the same dir as the form
does:

<?php
   include '../../php/dbtabledisplay.php');
?>

When I run this form as shown I get a blank page with exactly no information.

But then I change the first line of the form section to look like this:

<form action="../../php/dbtabledisplay.php" method="POST">

I.e. I move the form target off the current dir directly into the main php dir.

And then refresh the form so it is reloaded, then when I enter the same table
name and hit submit then the table content is displayed as requested!!!!

What is the problem with this?? It is there because it worked fine for many
years with PHP 5.3...

Is it not possible to use a php file inside the form directory as a handler when
all it does is to redirect to the main php handler?

I have also tested this for the dbtest.php file:
<?php
   include_once '../../php/dbtabledisplay.php');
?>

But no difference using include_once, it still does not work!

What do your error logs say? When you run into problems like this, always go to the error logs as the first thing, as the logs will almost always be giving useful information about what the exact issue is.

--
Ashley Sheridan
https://www.ashleysheridan.co.uk



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux