Jump to content

how to pick combo


fareedreg

Recommended Posts

how can i pick selected value entered by user in the next form from this combobox..

 

 

 

<?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);

 

?>

Link to comment
https://forums.phpfreaks.com/topic/186662-how-to-pick-combo/
Share on other sites

i dont quite understand your question, but if you want the value entered in the select box, on whatever page that form submits to, you can access the value like so

$value = $_POST['item'];

 

its $_POST['item'] because "item" is the name of the form

Link to comment
https://forums.phpfreaks.com/topic/186662-how-to-pick-combo/#findComment-985825
Share on other sites

NOT WORKING

 

i dont quite understand your question, but if you want the value entered in the select box, on whatever page that form submits to, you can access the value like so

$value = $_POST['item'];

 

its $_POST['item'] because "item" is the name of the form

Link to comment
https://forums.phpfreaks.com/topic/186662-how-to-pick-combo/#findComment-985829
Share on other sites

complete code

 

 

 

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

-->

</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">

 

 

 

    <?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);

 

?>

   

   

   

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

 

 

 

 

 

memmodify.php

 

<?php

 

$memval=$_POST['item'];;

 

 

include('connect.php');

$Tb = "mem_master";

 

mysql_select_db($Db, $link);

                           

$query = "select * from mem_master where mem_id='$memval'";

 

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

 

$fel=mysql_num_fields($result);

$nro=mysql_num_rows($result);

 

 

Link to comment
https://forums.phpfreaks.com/topic/186662-how-to-pick-combo/#findComment-985830
Share on other sites

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.