this is my code..i cannot find my mistake
thanks in advance
Code:
<head> <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <title>TestPage</title> <script type="text/javascript">
function contactSelect() {
var selectedValue = document.getElementById("cd-dropdown").value;
document.getElementById("Background").style.visibility = "hidden";
document.getElementById("Objective").style.visibility = "hidden";
document.getElementById("Contact Us").style.visibility = "hidden";
document.getElementById("Director").style.visibility = "hidden";
document.getElementById("Office").style.visibility = "hidden";
if(selectedValue == "1")
document.getElementById("Background").style.visibility = "visible";
if(selectedValue == "2")
document.getElementById("Objective").style.visibility = "visible";
if(selectedValue == "3")
document.getElementById("Contact Us").style.visibility = "visible";
if(selectedValue == "4")
document.getElementById("Director").style.visibility = "visible";
if(selectedValue == "5")
document.getElementById("Office").style.visibility = "visible";
}
</script> </head> <body onload="contactSelect();"> <select id="cd-dropdown" class="cd-select" onchange="contactSelect();"> <option value="-1" selected>Choose a contact information</option> <option value="1">Background</option> <option value="2">Objective</option> <option value="3">Contact Center</option> <option value="4">Contact Director</option> <option value="5">Contact Office Manager</option> </select> <div class="fleft"> <?php //to make connection with database
$conn=mysql_connect("localhost","root","") or die(mysql_error());
//to select the targeted database
mysql_select_db("ickp",$conn) or die(mysql_error());
//Create query
$query="SELECT * FROM about";
//to run sql query in database
$result=mysql_query($query,$conn) or die(mysql_error());
//Check whether the query was successful or not
if(isset($result)){
if(mysql_num_rows($result) == 1) {
//Login Successful
while ($row = mysql_fetch_array($result)){
?> <div id="Background" class="display" style="display:none"> <?php
echo "$row[background]<br/>";
?> </div> <div id="Objective" class="display" style="display:none"> <p>Among the key areas conducted by the Center are:</p><br /> <?php
echo "<p>1. $row[objective1]</p><br/>";
echo "<p>2. $row[objective2]</p><br/>";
echo "<p>3. $row[objective3]</p><br/>";
echo "<p>4. $row[objective4]</p><br/>";
?> </div> <div id="Contact Us" class="display" style="display:none"> <?php
echo "<p><strong>$row[CoEname]</strong></p>";
echo "<p>$row[UniName]</p>";
echo "<p>$row[road]</p>";
echo "<p>$row[postcode], $row[city]</p>";
echo "<p>$row[state]</p>";
echo "<p>Fax: $row[fax]</p><br/>";
?> </div> <div id="Director" class="display" style="display:none"> <?php
echo "<p><strong>$row[director]</strong></p>";
echo "<p>$row[d_email]</p>";
echo "<p>$row[d_phone]</p><br/>";
?> </div> <div id="Office" class="display" style="display:none"> <?php
echo "<p><strong>$row[office]</strong></p>";
echo "<p>$row[o_email]</p>";
echo "<p>$row[o_phone]</p><br/>";
?> </div> <?php
}
}}
else {
die("Query failed");
}
?> </div></body> </html>
Comment