please help me to find out where i am doing mistake in this code? i wnat retieve the value that i am
- by user309381
function reload(form)
{
var val = $('seltab').getValue();
new Ajax.Request('Website.php?cat=' +escape(val),
{
method:'get',
onSuccess: function(transport){
var response = transport.responseText ;
$("MyDivDB").innerHTML = transport.responseText ;
alert("Success! \n\n" + response);
},
onFailure: function(){ alert('Something went wrong...') }
});
}
</script>
</head>
title
author
pages
$con = mysql_connect($dbhostname,$dbuserid,$dbpassword);
if(!$con)
{
die ("connection failed".mysql_error());
}
$db = mysql_select_db($dbname,$con);
if(!$db)
{
die("Database is not selected".mysql_error());
}
$query ="SELECT * FROM books NATURAL JOIN authors" ;
$result = mysql_query($query);
if(!$query)
{
die("Database is not query".mysql_error());
}
while($row = mysql_fetch_array($result,MYSQL_ASSOC))
{
$title = $row["title"];
$author = $row["author"];
$page = $row["pages"];
echo "<tr>";
echo "<td>$title</td>";
echo "<td>$author</td>";
echo "<td>$page</td>";
echo "</tr>";
}
print "</table>";
echo "<select id = seltab onchange = 'reload(this.form)'>";
$querysel = "SELECT title_id,author FROM authors NATURAL JOIN books";
$result1 = mysql_query($querysel) ;
while($rowID = mysql_fetch_assoc($result1))
{
$TitleID = $rowID['title_id'];
$author = $rowID['author'];
print "<option value = $author>$author\n";
print "</option>";
}
print "</select>";
?
Wbsite.php