Jump to content

Recommended Posts

so i have a message script when you click on a message it is supposed to load the message into a div this works until i hit "page 2" on my pagination then it just opens a new page with the content in it. i am fetching the content from the div from the following file. if anyone can tell me where i am going wrong please do. :confused:

 

 

Messages.php

<?php

ob_start();

if($_POST['ajax_option']!=''){

    require_once('.global.php');

    $m_id=$_GET['m_id'];

}



require_once('inc/agent_functions.php');

//require_once('fvalidation.php');

include_once('configurations.php');

include_once('inc/tripwire_functions.php');





// Check to see if user has an active session

if($_SESSION['fname'] == "" and $_POST['ajax_option']==''){

echo '	

<p>You must be logged in to place an ad. Please log in<br />

<form name="form2" method="post" action="index.php?content=checkuser&page=cc">

	<span class="maintext">User Name :</span>          

        <input type="text" name="username" />

        <br />

        <span class="maintext">Password:  </span>  

        <input type="password" name="password" />

        <br />

        <br />

        <input type="submit" name="Submit" value="Submit">        

</form>

    <br />

    <span class="maintext">

    	<a href="index.php?content=lostpasswordform">Forgot Password</a>

    </span></p>';

}else{





// Gets the data

$id=isset($_POST['id']) ? $_POST['id'] : '';

$search=isset($_POST['search']) ? $_POST['search'] : '';

$multiple_search=isset($_POST['multiple_search']) ? $_POST['multiple_search'] : array();

$items_per_page=isset($_POST['items_per_page']) ? $_POST['items_per_page'] : '';

$sort=isset($_POST['sort']) ? $_POST['sort'] : 't_t_1d_t';

$page=isset($_POST['page']) ? $_POST['page'] : 1;

$total_items=(isset($_POST['total_items']) and $_POST['total_items']>=0) ? $_POST['total_items'] : '';

$extra_cols=isset($_POST['extra_cols']) ? $_POST['extra_cols'] : array();



// Uses the creativeTable to build the table

include_once('creativeTable.php');





$ct=new CreativeTable();



// Data Gathering

$params['sql_query']            = 'SELECT id,received_by,date,subject FROM notifications WHERE member_id=' . $m_id  ;   // IMPORTANT: you must specify the fields and not use *

$params['search']               = $search;

$params['multiple_search']      = $multiple_search;

$params['items_per_page']       = $items_per_page;

$params['sort']                 = $sort;

$params['page']                 = $page;

$params['total_items']          = $total_items;







// Layout Configurations (Most used - the commented lines are the default values)

$params['header']               = 'id,Sender,date,subject';    // If you need to use the comma use &#44; instead of ,

$params['width']                = '30,180,70';

$params['items_per_page_init']  = '7';               // default: '10*$i';

$params['ajax_url'] = 'messages.php?m_id='.$m_id;



$ct->table($params);



//print_r($ct);



$ct->pager = getCreativePagerLite('ct',$page,$ct->total_items,$ct->items_per_page);



// the data from the sql query is stored in the $ct->data in a 2D array format

//    [0] => Array

//        (

//            [0] => 1

//            [1] => 9.1

//            [2] => The Shawshank Redemption (1994)

//            [3] => 489048

//        )

//

//    [1] => Array

//        (

//            [0] => 2

//            [1] => 9.1

//            [2] => The Godfather (1972)

//            [3] => 392126

//				)

//

//		...



// Now you can adjust the data for your needs



foreach($ct->data as $key => $value){



	$ct->data[$key][3]='<a class="ezjax" href="view_message.php?id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>'; 







//  $ct->data[$key][3]='<a class="ezjax" href=" onclick="part2('.$ct->data[$key][0].');" href="javascript:void();">'.$ct->data[$key][3].'</a>';



//foreach($ct->data as $key => $value){

  //$ct->data[$key][3]='<a href=#" onclick="part2();" href="&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';



// $ct->data[$key][3]='<a onclick="part2();" href="#&id='.$ct->data[$key][0].'">'.$ct->data[$key][3].'</a>';

    //$ct->data[$key][2]='<a href="something.php?id=#COL1#">'.$ct->data[$key][2].'</a>'; //you may use also the tags #COL1#, #COL2#, ...

}



if($_POST['ajax_option']!=''){

    echo json_encode($ct->display($_POST['ajax_option'],true));

    exit;

}else{

    $out=$ct->display();

}

echo '<div id="notification_container">';

?>  

    <?php  print_r($out);?>



<?php 





echo "

<br><br>



<div id=\"ezjax_content\">



</div>



<br><br><br><br>    



</div>







";







}









?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.