populate drop down menu cant retrieve value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ruchi choudhary
    New Member
    • Nov 2012
    • 22

    populate drop down menu cant retrieve value

    Hi,

    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
    Code:
    <!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>
    &nbsp;&nbsp;<FONT size="5"><a href="date2.html">NAIP</a>&nbsp;&nbsp;&nbsp;
    <a href="date2.html"><blink>National Fellow</blink></a>&nbsp;&nbsp;&nbsp;
    <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> &nbsp;&nbsp;<?php include("pop.php"); ?>
    
    
    <br><br>&nbsp;&nbsp;
    <p align="left"><font color="#fff" size="3">
    <input type='button' onclick='ajaxFunction()' value='SUBMIT' /> </p>
    </p>
    </form>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
     	
            
            
    <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>
    pop.php

    Code:
    <?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>";
    
    ?>
    nfret.php
    Code:
    <?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 "&nbsp;&nbsp;&nbsp;head &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='text' name='head' value='".$row['head']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;description &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='text' name='description' value='".$row['description']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;fileno &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='varchar' name='fileno' value='".$row['fileno']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;Nameoffirm &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='text' name='Nameoffirm' value='".$row['Nameoffirm']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;exp &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='exp' value='".$row['exp']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;dateofsanction &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='date' name='dateofsanction' value='".$row['dateofsanction']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;dateofpo &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='date' name='dateofpo' value='".$row['dateofpo']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;dateofindent &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='date' name='dateofindent' value='".$row['dateofindent']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;billno &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='billno' value='".$row['billno']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;dateofbillno &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='date' name='dateofbillno' value='".$row['dateofbillno']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;BLno &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='BLno' value='".$row['BLno']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;billpass &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='varchar' name='billpass' value='".$row['billpass']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;Head &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='billamt' value='".$row['billamt']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;dateofbill &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='date' name='dateofbill' value='".$row['dateofbill']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;availbal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='availbal' value='".$row['availbal']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;progbal &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='int' name='progbal' value='".$row['progbal']."'><br/><br/>";
    echo "&nbsp;&nbsp;&nbsp;remark &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='varchar' name='remark' value='".$row['remark']."'><br/><br/>";
    
    }
    
    mysql_close($con);
    ?>
Working...