Responsive Tabs / Posts /

How to load php dynamic pages using AJax Tab

15
Hi, I have been having problems loading a php page using the ajax tab option. Below is an example webpage and here is the tab anchor I am using:

Website:
http://eddmuspostal.com/youraccount.php


<a href="includes/your-account-includes/uploaded-files.php" data-ajax="{target: 'view3', id: 'fragment1'}">Previously Uploaded Files</a>

<div id="view3"> </div>
Will  10 years ago   viewed: 19811    

5 Answers

2
Your page /includes/your-account-includes/uploaded-files.php contains only the <h2 align=center>Uploaded Files</h2> and it is retrieved and displayed. Nothing wrong.
Milo   10 years ago
1
In actuality this is the uploaded-files.php. What's being displayed is the html mark up and not the php.

<h2 align=center>Uploaded Files</h2>
<?php
//This is for displaying uploaded templates
include_once ($_SERVER['DOCUMENT_ROOT']."/includes/db_connect.php");
// Check connection
if (mysqli_connect_errno())
  {
 echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
 
  $result = mysqli_query($con,"SELECT * FROM images WHERE UserName='$Username'");
//WILL NOTE
while($row = mysqli_fetch_array($result)){
?>

<a href="<?php echo $row['ImageLink']?>" onclick="NewWindow(this.href,'mywin','500','500','no','center');return false" onfocus="this.blur()">
<?php
$address = $row['ImageLink'];
$last3chars = substr($address, -3); 
if(($row['ImageLink']!="")&&($last3chars!="pdf")){

    echo "<img src=$row[ImageLink] width=80> </a>  <a href=zip.php?Option1=$row[ImageLink]>[Use This Template]</a> ";

}else{

    //the path to the PDF file
    $strPDF = $row['ImageLink'];
    $imagelinkname =(rand(10000000,999999999));
    exec("convert \"{$strPDF}[0]\" -colorspace RGB -geometry 200 \"_optionfiles/step1/$imagelinkname.gif\"");
    echo "<img src='_optionfiles/step1/$imagelinkname.gif' width='80'> </a> <a href=zip.php?Option1=$row[ImageLink]>[Use This Template]</a> ";
}       
?>
<?php
}
?>
Will   10 years ago
1
No matter what your PHP code is, the page will render out the HTML code, and the rendered HTML code should contain:
<div id="fragment1">....(the fragment content)....</div>. From your page I only find <h2 align=center>Uploaded Files</h2>. So you need to double check your PHP code which I am not good at.
Milo   10 years ago
1
Okay got it to work lol. It was indeed the session. I guess when the page is called the current session isn't carried over... So for future reference, if anybody has php that requires session data... my solution was to unset and set the session:
<?php
session_unset();
session_start();$Username = $_SESSION['Username'];
?>
Will   10 years ago
0
After a few tests- the issue is with the session. The Username is not being recognized- though, it is assigned correctly.
Will   10 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: