Hi.
I'm working on a webpage that displays all the submitted the reviews, that haven't been approved for viewing yet by an admin.
I'm storing all the reviews in the array, each review is in the class which holds all the info about it. So it's an array of classes. On my first page depending on which button admin pushes the index is passed to the next page, and the array is passed in SESSION. Now here is my problem, when I try to access a class from array, which I retrive from SESSION, in a second page it says that class is incomplete. If I do same thing (for testing purposes only), on the first page it works! First page and second page both have
require("files.php"). This file contains the all the nesseary includes, so both pages have an include of the Review class. In that file I also have an include for another class called User which is used elsewhere in the webpage. Could that be causing problems?
Here is some relevant code, in case it wasn't clear what I was talking about.
First page.
<?php
require("files.php");
....
else
{
connect_reviewdb();
//in dbfunctions.php gets all the unreviewd animes from the db
//and stores them in the array of objects
$articles_array = get_unreviewed_animes();
$display_block;
//puts array of objects in to session
$_SESSION['reviews']=$articles_array;
$article_arrays = $_SESSION['reviews'];
$counter=0;
//displays info on each unreviewed article
foreach($articles_array as $article)
{
$article_id = $article->get_articleid();
$anime_id = $article->get_animeid();
$user_id = $article->get_userid();
$places_tobuy = $article->get_places();
$ratting = $article->get_ratting();
$timestamp = $article->get_timestamp();
$text = substr($article->get_text(), 0, LENGTH);
$text .= "...";
$anime_name= get_anime($anime_id);
$user_nick = get_nick($user_id);
$display_block .= "<center><b><strong>Review for: $anime_name</strong></b></center><br /><br />";
$display_block .= "Submitted by: $user_nick<br />
Article id: $article_id<br />
Anime id: $anime_id <br />
User id: $user_id<br />
Places to buy: $places_tobuy<br />
Ratting: $ratting<br />
Timesamp: $timestamp<br />
Text: $text<br />
<br />
<br />
<center>
<form action='edit.php' method='POST'>
<input type='hidden' name='index' value='$counter'>
<input type='submit' value='Review Submittion'>
</form> </center>";
$counter +=1;
}
}
Second page
require("files.php");
$index_review = $_POST['index'];
$reviews_array=$_SESSION['reviews'];
$article=$reviews_array[$index_review];
var_dump($article);
$displayblock .= "this is a test: ";
$displayblock .= $index_review;
....
files.php
<?php
//J files
//User class file
require("../User.php");
require("../auth.php");
require("../db.php");
//my files
require("dbfunctions.php");
require("connectdb.php");
require("usr.php");
require("session.php");
//Review class file
require("review.php");
if (!auth_logged_in())
{
header("location: ../login.php");
}
?>