Actually I am working on populate drop down menu in which population work means all value for file no.come into drop down menu but cant retrieve data form mysql database.Its urgent for me so please help me.
popl.php
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
- <head>
- <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
- <title>genome analysis lab</title>
- <link rel="stylesheet" type="text/css" media="screen" href="dbpage.css" />
- </head>
- <script language="javascript" type="text/javascript">
- <!--
- //Browser Support Code
- function ajaxFunction(){
- var ajaxRequest; // The variable that makes Ajax possible!
- try{
- // Opera 8.0+, Firefox, Safari
- ajaxRequest = new XMLHttpRequest();
- } catch (e){
- // Internet Explorer Browsers
- try{
- ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
- } catch (e) {
- try{
- ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e){
- // Something went wrong
- alert("Your browser broke!");
- return false;
- }
- }
- }
- // Create a function that will receive data sent from the server
- ajaxRequest.onreadystatechange = function(){
- if(ajaxRequest.readyState == 4){
- var ajaxDisplay = document.getElementById('ajaxDiv');
- ajaxDisplay.innerHTML = ajaxRequest.responseText;
- }
- }
- var fileno = document.getElementById('fileno').value;
- var queryString = "?fileno=" + fileno;
- ajaxRequest.open("GET", "nfret.php" + queryString, true);
- ajaxRequest.send(null);
- }
- //-->
- </script>
- <body>
- <div id="container">
- <div id="intro">
- <div id="pageHeader">
- <h1><span>Genome Analysis Lab</span></h1>
- <h2><span>Purchase database</span></h2>
- </div>
- <FONT size="5"><a href="date2.html">NAIP</a>
- <a href="date2.html"><blink>National Fellow</blink></a>
- <a href="date2.html">NFBSFARA</a></font>
- <br><br><br>
- <form action="nfret.php" method='get'>
- <p align ="left"><font color="#fff">
- <font size="3pt"><b>Fileno</b>:</font> <?php include("pop.php"); ?>
- <br><br>
- <p align="left"><font color="#fff" size="3">
- <input type='button' onclick='ajaxFunction()' value='SUBMIT' /> </p>
- </p>
- </form>
-
- <div id='ajaxDiv'><font size="4" color="#fff">Your result will be display here:</font></div>
- <br><br><br><br>
- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
- <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
- <div id="linkList">
- <div id="linkList2">
- <div id="lselect">
- <ul>
- <li><a href="naip1.html">Retrieval</a></li>
- <li><a href="nfrc.html">Insertion</a></li>
- <li><a href="nfmain.html">Home</a></li>
- </ul>
- </div>
- </body>
- </html>
Expand|Select|Wrap|Line Numbers
- <?php
- $dbhost = 'localhost';
- $dbuser = 'root';
- $dbpass = '';
- $dbname = "purchase";
- $conn = mysql_connect($dbhost, $dbuser, $dbpass);
- mysql_select_db($dbname) or die(mysql_error());
- if(! $conn )
- {
- die('Could not connect: ' . mysql_error());
- }
- $sql = "SELECT fileno FROM nfone";
- $result = mysql_query($sql);
- echo "<select name='fileno'>";
- while ($row = mysql_fetch_array($result)) {
- echo "<option value='" . $row['fileno'] . "'>" . $row['fileno'] . "</option>";
- }
- echo "</select>";
- ?>
Expand|Select|Wrap|Line Numbers
- <?php
- error_reporting (E_ALL ^ E_NOTICE);
- $con = mysql_connect("localhost","root","");
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("purchase", $con);
- $head = $_GET['head'];
- $description = $_GET['description'];
- $fileno=$_GET['fileno'];
- $Nameoffirm = $_GET['Nameoffirm'];
- $exp = $_GET['exp'];
- $dateofsanction = $_GET['dateofsanction'];
- $dateofpo = $_GET['dateofpo'];
- $indentno = $_GET['indentno'];
- $dateofindent = $_GET['dateofindent'];
- $billno = $_GET['billno'];
- $dateofbillno = $_GET['dateofbillno'];
- $BLno = $_GET['BLno'];
- $billpass = $_GET['billpass'];
- $billamt = $_GET['billamt'];
- $dateofbill = $_GET['dateofbill'];
- $availbal = $_GET['availbal'];
- $progbal = $_GET['progbal'];
- $remark = $_GET['remark'];
- $result = mysql_query("SELECT * FROM nfone WHERE fileno = '$fileno'");
- while($row = mysql_fetch_array($result))
- {
- echo " head <input type='text' name='head' value='".$row['head']."'><br/><br/>";
- echo " description <input type='text' name='description' value='".$row['description']."'><br/><br/>";
- echo " fileno <input type='varchar' name='fileno' value='".$row['fileno']."'><br/><br/>";
- echo " Nameoffirm <input type='text' name='Nameoffirm' value='".$row['Nameoffirm']."'><br/><br/>";
- echo " exp <input type='int' name='exp' value='".$row['exp']."'><br/><br/>";
- echo " dateofsanction <input type='date' name='dateofsanction' value='".$row['dateofsanction']."'><br/><br/>";
- echo " dateofpo <input type='date' name='dateofpo' value='".$row['dateofpo']."'><br/><br/>";
- echo " dateofindent <input type='date' name='dateofindent' value='".$row['dateofindent']."'><br/><br/>";
- echo " billno <input type='int' name='billno' value='".$row['billno']."'><br/><br/>";
- echo " dateofbillno <input type='date' name='dateofbillno' value='".$row['dateofbillno']."'><br/><br/>";
- echo " BLno <input type='int' name='BLno' value='".$row['BLno']."'><br/><br/>";
- echo " billpass <input type='varchar' name='billpass' value='".$row['billpass']."'><br/><br/>";
- echo " Head <input type='int' name='billamt' value='".$row['billamt']."'><br/><br/>";
- echo " dateofbill <input type='date' name='dateofbill' value='".$row['dateofbill']."'><br/><br/>";
- echo " availbal <input type='int' name='availbal' value='".$row['availbal']."'><br/><br/>";
- echo " progbal <input type='int' name='progbal' value='".$row['progbal']."'><br/><br/>";
- echo " remark <input type='varchar' name='remark' value='".$row['remark']."'><br/><br/>";
- }
- mysql_close($con);
- ?>