I have an image map of a property plot, each lot is clickable to change the DIV content to backend.php. Now my index.php file had the dBase connect script at the top as per usual, however the backend.php in the DIV will not connect to the dBase with the connection script JUST in the index, backend.php will not pull data without the connect script in it specificly.
index.php loads the lot.php by variables in the url, so index uses an INCLUDE
- <HTML> <!-- index.php -->
- <?php SESSION_START(); INCLUDE "db_connect.inc"; ?>
- <HEAD>
to put the lots.php page in it. The lots.php has a table with a simple DIVMy jquery that controls the click to change DIV is:
- <TD WIDTH="310" STYLE="background:url('img/lots_bg.png') no-repeat">
- <DIV ID="content">Phase 1 is currently under contruction</DIV>
- </TD>
my backend.php that gets loaded after all this has to have the connection script
- $(document).ready(function() {
- $("area").click(function() {
- var prop = $(this).attr("href");
- $("#content").fadeOut("slow",function() {
- $("#content").load("backend.php",{propid: prop});
- });
- $("#content").fadeIn("slow");
- return false;
- });
- });
in it in order to work, why? has anyone run into this?
I don't want to have to have the connection script run twice on the same site on
the same page.
- <?php
- INCLUDE "db_connect.inc";
- IF(isset($_POST['propid'])) {
- $pid = $_POST['propid'];
- $ph = substr($pid,2,1);
- $lt = substr($pid,-2,2);
- $getProp = "SELECT * FROM lots WHERE phase='$ph' AND lot='$lt'";
- $getProp_Q = mysql_query($getProp);
- $getProp_R = mysql_fetch_array($getProp_Q);
- ECHO "<H2>Phase ".$ph." | Lot # ".$lt."</H2>";
- }
- ?>
- <?php MYSQL_CLOSE($link); ?>