Jump to content

how to fill combo box


fareedreg

Recommended Posts

Here's the logic behind it, assuming you'd know how to code it.

 

<?php
>> SELECT info FROM database
?>

<select name="x" id="x">
   <?php
       while(result = mysq_fetch_assoc($sql))
       {
           echo "<option value='value'>text</option>";
        }     
   ?>
</select>

Thanks friend  but can i also fix this combo box to a particular  location in my code.

 

Here's the logic behind it, assuming you'd know how to code it.

 

<?php
>> SELECT info FROM database
?>

<select name="x" id="x">
   <?php
       while(result = mysq_fetch_assoc($sql))
       {
           echo "<option value='value'>text</option>";
        }     
   ?>
</select>

this my html code ,, I want  it after MemberID. thanks

 

 

 

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

.style4 {font-size: 36px}

.para {

width: auto;

}

body,td,th {

font-size: 14px;

}

-->

</style>

</head>

<body>

<div align="center"><img src="images/libimage.jpg" width="998" height="103" /></div>

<p> </p>

<table width="572" height="61" align="center">

  <tr>

    <td align="center" valign="middle"><p class="style4">MEMBER SEARCH</p>

    <p><a href="index.html"><img src="images/mainmenu.gif" width="128" height="40" /></a><span class="style4"><a href="membermaster.html"><a href="membermaster.html"><img src="images/return.gif" width="128" height="40" /></a></span></p></td>

  </tr>

</table>

<p> </p>

<form name="memmaster" method="post" action="memmodify.php">

<table width="259" border="0" align="center">

  <tr>

    <td width="105">Member Id</td>

    <td width="144"> </td>

  </tr>

</table>

<p> </p>

<table width="129" border="0" align="center">

  <tr>

    <td width="66"><input name="cmdsubmit" type="submit" id="cmdsubmit" value="Search" /></td>

    <td width="53"><input type="reset" name="cmdclear" id="cmdclear" value="Clear" /></td>

  </tr>

</table>

 

<p> </p>

<p> </p>

<p> </p>

 

 

</body>

 

</html>

 

 

 

 

 

Yea simply by placing that code snippet directly where you want the box to show up

current i m doing

 

 

<?php

 

include('connect.php');

 

$Tb = "mem_master";

 

mysql_select_db($Db, $link);

                           

$query = "select mem_id from mem_master order by mem_id";

 

$result= mysql_query($query,$link);

 

$fel=mysql_num_fields($result);

$nro=mysql_num_rows($result);

 

if ($nro>0)

 

{

   

    echo "<select name='item'>\n";

       

    echo "<option>-- Select Item --</option>\n";   

       

    while ($row=mysql_fetch_array($result))

 

    {

   

            echo "<option value='$row[item]'>$row[mem_id]</option>\n";

       

    }                       

                             

}

 

mysql_close($link);

 

?>

 

 

 

 

but in this method box appear some where else

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.