.val problems

.val problems

Hello Every one.

I'm quite new to jQuery so as you'd expect I've run into a few problems.

I have a form that has a drop down list at the top of it. When the drop down list is changed i t is supposed to send a post request to the next page which in turn recreates the form but fills it with the appropriate datat. I had it all working amost properly using the .text insted of f .val but this returned the value for all of the select items . So now I need some help. Below is a the jQuery bit and below that the form. Then below that again is the page it forwards too. Thank you very much for any help you cn give me.

Rich


<script type="text/javascript">
$(doc<?php
$query = "SELECT * FROM quotes ORDER BY quote";
$result = mysql_query ($query);
mysql_data_seek($result, 0);
$old_quote = mysql_fetch_array($result);

echo "<div id=\"pg_name\">Choose quote :</div><div id=\"pg_name_inputs\"><select name=\"book_exists\" id=\"book_exists\">";
// printing the list box select command
echo "<option value=\"\">Select a quote</option>";
while($old_quote=mysql_fetch_array($result)){
$auhtor = $old_quote['author'];
$quote = $old_quote['quote'];
echo "<option id=\"quote_sel\" value=\"$quote\">".$quote."</option>";
/* Option values are added by looping through the array */
}
echo "</select></div>";
?>

<p style="margin-left: 100px">or add new quote</p>
<div id="refresh_quote">
<div id="pg_name">Author : </div><div id="pg_name_inputs"><input name="author" calss="inputform" type="text" id="author" value="<?php $author ?>"/></div>
<div id="pg_name">Source : </div><div id="pg_name_inputs"><input name="source" calss="inputform" type="text" id="source" value="<?php $source ?>"/></div>
<div id="sec_name">Quote : </div><div id="pg_name_inputs"><textarea name="quote" rows="10" width="300px" calss="inputform" id="quote" value="<?php $quote ?>"></textarea></div>
<div id="pg_name"></div><div id="pg_name_inputs"><input name="Clear" type="reset" class="button" id="Clear" value="Clear" /><input name="Submit" type="submit" class="button" value="Send" /></div>
<div id="last_update"></div>
</div>
<br style="clear: both;"/>
<br style="clear: both;"/>
----------------------------
----------------------------

<?php
session_start();
if (!empty($_POST['value'])) {
$value = $_POST['value'];
} else {
$value = "Did not work";
}
include $_SERVER["DOCUMENT_ROOT"]."/admin/lib/inc/dbquery.inc";
$query = "SELECT * FROM quotes WHERE quote = '$value'";
$result = mysql_query ($query);
$inputs = mysql_fetch_array($result);
$author = $inputs['author'];
$source = $inputs['source'];
$quote = $inputs['quote'];

echo "<div id=\"pg_name\">Author : </div><div id=\"pg_name_inputs\"><input name=\"author\" calss=\"inputform\" type=\"text\" id=\"author\" value=\"$author\"/></div>
<div id=\"pg_name\">Source : </div><div id=\"pg_name_inputs\"><input name=\"source\" calss=\"inputform\" type=\"text\" id=\"source\" value=\"$source\"/></div>
<div id=\"sec_name\">Quote : </div><div id=\"pg_name_inputs\"><textarea name=\"quote\" rows=\"10\" width=\"300px\" calss=\"inputform\" id=\"quote\" value=\"$value\">".$value."</textarea></div>
<div id=\"last_update\"></div><div id=\"pg_name_inputs\"><input name=\"Clear\" type=\"reset\" class=\"button\" id=\"Clear\" value=\"Clear\" /><input name=\"Submit\" type=\"submit\" class=\"button\" value=\"Send\" /></div>";
echo $value;
echo "...";
?>