Hello everyone. I'm new to this forum and PHP in general.
I finally got the nerve to tackle a mySql Database on my website's server, added columns and a few values, although I cannot seem to find any online help to retrieve the values from the database table.
Here is my test html page.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mySql beta test</title>
</head>
<body>
<div id="content">Selected Year:</div>
<select id="years" onclick="javascript:getValues();" style="font-size:32px;">
<option>2011</option>
<option>2010</option>
<option>2009</option>
</select>
<script type="text/javascript">
function getValues() {
var i = document.getElementById('years').selectedIndex;
var selectedYear = document.getElementById('years').options[i].value;
var selDBitems = '';
// Need help here to connect to mySql, retrieve all items in table that have the selected year,
// and write the values to a string.
// selDBitems += ?????
document.getElementById('content').innerHTML = selDBitems;
}
</script>
</body>
</html>
Basically, I want to connect to mySql's table, which has 4 columns for: year,name,info,description, and retrieve values.
For this thread and to get my head a little more clear about using php, I only need to retrieve the database items that have the same year as the year selected in the <select> box.
Thanks kindly in advance.