table name=location
feilds=DevID , Location
couldn't embed javascript in php ..
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="css\style.css" />
</head>
<body>
<div id="page">
<div id="header">
<div id="headerTitle" align='center'>National Transmission & Dispatch Monitoring System</div>
<div id="headerSubText">Give Subtitle here...</div>
</div>
<div id="bar">
<div class="navLink"><a href="index.html">home</a></div>
<div class="navLink"><a href="index.html">about us</a></div>
<div class="navLink"><a href="index.html">products</a></div>
<div class="navLink"><a href="index.html">services</a></div>
<div class="navLink"><a href="index.html">portfolio</a></div>
<div class="navLink"><a href="index.html">our process</a></div>
<div class="navLink"><a href="index.html">contact</a></div>
</div>
<div class="contentTitle"><h1>Field title</h1></div>
<div class="contentText">
<?php
$connect=mysql_connect('127.0.0.1','root','');
if(!$connect){ die('error connecting :' .mysql_error());}
$database=mysql_select_db('SERVER',$connect);
if(!$database){die('couldnt select database :' .mysql_error());}
echo "<table align='center'>";
echo"<tr>";
echo"<td>";
echo "<h1 align='center'><b>C@RE</b><h1>";
echo"</td>";
$query=("Select Location from location");
$result=mysql_query($query);
if(!$result){die('no entry in table :' .mysql_error());}
echo"</tr>";
echo"<tr>";
echo"<td>";
echo "<select name='id' id='devlocation'>\n";
echo "<option value='nothing' selected='selected' onchange=''>--DeviceID--</option>\n";
echo"<script type='text/javascript'>
var selectlocation=document.getElementById(devlocation);
selectlocation.onchange=function()
{
var chosenoption=this.options
[this.selectedIndex]
if(chosenoption.value!='nothing'){window.open (chosenoption.value,'','')}
}
</script>";
while($row=mysql_fetch_array($result))
echo"<option value='$row[Location]'>$row[Location]</option>\n";
echo "</select>\n";
echo"</td>";
echo"</tr>";
echo"<tr>";
echo"<td>";
echo "<input type='submit' value='PLOT' />";
echo"</td>";
echo"</tr>";
echo"</table>";
?>
</div>
<div id="footer"></div>
</body>
</html>

New Topic/Question
Reply


MultiQuote




|