Alright just a few minor problems:
function ajaxGetInfo(title)
{
a = ajax();
if(a!=null)
{
a.onreadystatechange = function() { if(a.readyState == 4) document.getElementById('info').value = a.responseText; }
a.open("GET", "includes/getDescription.php?title="+title, true);
a.send(null);
}
else document.getElementById('info').value = "Error retrieving data!";
}
function ajax()
{
if(window.XMLHttpRequest) return new XMLHttpRequest();
if(window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
return null;
}
index2.php
<?php
session_start();
// Checks if the user isn't registered in session
if (!isset($_SESSION['user'])) echo header("Location: login.php");
?>
<!doctype html>
<html>
<head>
<?php
require_once("includes/connection.php");
require_once("includes/functions.php");
include("includes/header.php");
?>
</head>
<body>
<?php
include("includes/nav.php");
include("includes/upper_content.php");
include("includes/getDescription.php");
?>
<div id="main_body">
<table width="936" align="center" cellpadding="10">
<tr>
<td align="center">
<p align="center">Enter your addition to one of the books in the drop-down list. There is no length limit.</p>
<hr />
<table>
<tr>
<td align="center">
<form method="post" action="submit_contribution.php">
<fieldset>
<legend>Select a Book:</legend><br />
<?php $result = mysql_query("SELECT id, book_name FROM iin_books"); ?>
<select name="category" onchange="ajaxGetInfo(this.value)">
<option>Select a book title...</option>
<?php if(mysql_num_rows($result)!=0): ?>
<?php while($nt=mysql_fetch_array($result)): ?>
<option value="<?=$nt['sub_cat_id']?>"><?=$nt['book_name']?></option>";
<?php endwhile;
endif; ?>
</select>
<p>Contribution:<br /> <textarea name="contribution" id="contribution" cols="50" rows="10"></textarea></p>
<p style="color:#F00; font-family:'Lucida Sans Unicode', 'Lucida Grande', sans-serif; font-size:12px;">
<input type="checkbox" /> I accept <a href="tou.php" style="color: #09F;">Terms of Use</a> and <a href="privacy.php" style="color:#09F;">Privacy Policy</a>.
</p>
<p><input type="submit" value=" Submit Your Contribution " /></p>
</fieldset>
</form>
</td>
<td valign="top">
<p>Book Description</p>
<textarea name="info" id="info" cols="20" rows="5" readonly></textarea>
</td>
</tr>
</table>
<br />
<br />
<a href="logout.php">Logout</a>
</td>
</tr>
</table>
</div>
<?php include("includes/footer.php"); ?>
</body>
</html>
Table styling...*cringe!*
getDescription.php:
<?php
require_once("includes/connection.php");
require_once("includes/functions.php");
function return_description($title)
{
//On the below line, replace * with the name of the row that …