displaying data for a single column from Mysql database in the list box in php form

displaying data for a single column from Mysql database in the list box in php form

I have a form in php.want to display data from a single column in an listbox in php.thanks..

View Answers

July 28, 2011 at 12:54 PM

<?php

$data = @mysql_query("select * from names");
echo "<p>Select a Name: n";
echo "<Select Name="ID">n";
while ($row = mysql_fetch_assoc($data))
{
$ID = $row['ID'];
$year = $row['name'];
echo "<option value=$ID>$namen";
}
echo "</select>n";
echo "</p>n";
?>

July 28, 2011 at 2:04 PM

YOUR CODE CONTAIN ERROR..
<?php

$data = @mysql_query("select * from names");
echo "<p>Select a Name: n";
echo "<Select Name="ID">n"; 
while ($row = mysql_fetch_assoc($data))
{
$ID = $row['ID'];
$year = $row['name'];
echo "<option value=$ID>$namen";  // close option tag
}
echo "</select>n";
echo "</p>n";
?>


you should write following type code..

<?php       
include('include/functions.php');
$Select = "SELECT * FROM category_master";
$Q = mysql_query($Select);
?>
<form name="myForm" method="post">
    <select name="select"> 
<?php  while($row = mysql_fetch_assoc($Q))
        {

        echo "<option value=''> $row[_cat_name] </option>";

        }
?>  
        </select>
</form>

July 28, 2011 at 2:27 PM

i am not getting the above code plz elaborate and explain


July 29, 2011 at 1:06 PM

 <?php      
    include('include/functions.php');  // Include DB Connection File.
        $table = "categorymaster"; // Table Name
        $field1 = "catname"; // Field Nmae
        // Change the Above Table Name and Field Name.

    echo "<form name='myForm' method='post'>"; // Start Form Tag for Posting Element.
    echo "<select>"; // Select Tag

        $Select = "SELECT * FROM $table"; // Select Query.
        $Q = mysql _ query($Select);  // Run Query.

        while($row = mysql_ fetch_ assoc($Q)) // Fetch Array in $row
        {
                echo "<option>"; // Start Option Tag.
                echo "$row[$field1]"; // Fetch Value From DB.
                echo "</option>"; // End Option Tab.
        } 
    echo "</select>"; // End Option Tab.
    echo "</form>"; // End Form Tab.
    ?>









Related Tutorials/Questions & Answers:
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column in an listbox in php.thanks..   <?php $data = @mysql_query("select
PHP list box mysql
PHP List box that displays the data from mysql table. User can select any value from the PHP list box. Example of PHP MYSQL List Box Code <?php if(isset($_GET['roll'])) { $username="root"; $password=""; $database
Advertisements
Fetch the data from mysql and display it on php form
Fetch the data from mysql and display it on php form  when i press on login button, after succesful login the related data of that person should be display in other textbox
How to insert multiple drop down list data in single column in sql database using servlet
How to insert multiple drop down list data in single column in sql database using servlet  i want to insert date of birth of user by using separate drop down list box for year,month and day into dateofbirth column in sql server
displaying data from ms excel in form.
displaying data from ms excel in form.  Hi all, I have a requirement... (for example). I need to display these data in a form. along with the actual picture... in the column of the excel and also the mechanism to get this data and display
retrive the data from access database to drop down list box in jsp
retrive the data from access database to drop down list box in jsp  hai, im new to jsp now im using the jsp along with access database.in table i load all the data's i need to retrive the data from database to dropdown list box
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
how to retrive the particular data from database in php with mysql?
how to retrive the particular data from database in php with mysql?  ..._db("samp", $con); $Name=$_POST['unames']; $data=mysql_query("SELECT * FROM tbl... like this.. <?php $con = mysql_connect("localhost","root
how to post data in mysql php form
how to post data in mysql php form  how to post data in mysql php form
Retrieving Data from Database to fill Combo Box
Retrieving Data from Database to fill Combo Box  Sir, I have a JSP Page with a combo box and a label. I have a database that has two fields id... displaying path that is stored in the database but not the image itself. Kindly
retrieve data from mysql database
retrieve data from mysql database  hi am not familiar in php.....even... selected value on combobox which is to be retrieve the relevant data from mysql...;/html> retcombosearch.php form is <?php mysql_connect ("localhost
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
jsp programe for displaying data from database
jsp programe for displaying data from database  i am using JSP.i want to insert data into database and also want to display the things i have entered..."')"); ResultSet rs = stmt.executeQuery( "SELECT * FROM data"); String id
displaying data retrieved from a database in a jsp page
displaying data retrieved from a database in a jsp page  the page should display username, emailid, telephone in addition to tthe tagline however... sql = "select billid, customerid, billdate, status from customerbills where
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page...; This tutorial shows you how to connect to MySQL database and retrieve the data from the database. In this example we will use tomcat version 4.0.3 to run our
php import data from excel to mysql
php import data from excel to mysql  php import data from excel to mysql
How to retrive an inmage from database and displaying it in imgae box - Swing AWT
How to retrive an inmage from database and displaying it in imgae box ...? I want to retrive an image from database and to display it in a small imagebox...(); f.setTitle("Display Image From database"); Image image = f.getToolkit
how to display image and text in single jsp page from the mysql database
how to display image and text in single jsp page from the mysql database  hello please help me to display the image and text in single jsp page from mysql database if have any reference code please send me Thanks in advance
form text box connection with mysql database feild - JDBC
form text box connection with mysql database feild  Respected Sir, What is the coding to connect a form text box field with mysql database table field will you explain me with simple example.. thanking you.. 
Data retrieve from mysql database
Data retrieve from mysql database  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list... from the dropdown, related data will get displayed on the textboxes. Here we have
Populate a combo box using data from a database
Populate a combo box using data from a database  Hi Guys, In need... combo box which will then load the next combo box values, now i know how to populate the first one, and then how to send the data off to a servlet and preform
Displaying file from database
Displaying file from database  I have list of files in my database. I... that corresponding file from database. I have list of file id related to search. I want... = "select file_data from file where id="+id; ResultSet rs = st.executeQuery
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I need to retrieve the records from the database for every 7 seconds and display... data from the database. After getting the response from the servlet am unable
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
how to create a php script to download file from database mysql
how to create a php script to download file from database mysql  how to create a php script to download file from databse mysql
retrieve the data to text fields from database on clicking the value of combo box
retrieve the data to text fields from database on clicking the value of combo box   retrieve the data to text fields from database on clicking... getting data into textarea from database table by clicking on the button
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Displaying data from combobox on the web page
Displaying data from combobox on the web page  Sir, I have to make a project in which a data from the database is to be displayed in combo box and depending on the choice made in combo box the data pertaining to it from
Use of Select Box to show the data from database
Use of Select Box to show the data from database   ... from the database using MySQL and we are forwarding this servlet data... from database This example will describe you the use of Select Box in a JSP
retrieve data from mysql database and store it in a variable ?
retrieve data from mysql database and store it in a variable ?  sir , I am working on a project , in which I have to apply operation on input data... that retrieve the integer values from the database and stored in the integer
How to retrive a particular record from database in php with mysql?
How to retrive a particular record from database in php with mysql?  Am using phpMyAdmin Database.In mysql database having 10 records. The field... record based on username and password. I dont know how to retrive in php with mysql
Acees data from database using combo box - JSP-Servlet
Acees data from database using combo box  please let me how i access the data from database when i select combo box combo2 having values Arts, Commerce, Science. this combo box will appear when first combo box class_name having
Data needs to be gathered in XML file from the database (MySql) using JSP
Data needs to be gathered in XML file from the database (MySql) using JSP ... data regarding particular id from the database table. Data needs to be gathered in XML file from the database (MySql) using appropriate JSP/Java Bean functions
sending data to google chart api from mysql database using java
sending data to google chart api from mysql database using java  how to send data from mysql database to google chart api using java
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core...=st.executeQuery("SELECT role_name from role WHERE dept_id=1234"); if(rs...(); gwf2 gp = new gwf2(); } }   We have used Mysql
how to retreive data dynamically from mysql to drop down list
how to retreive data dynamically from mysql to drop down list   sir, i created a table in mysql and i inserted some values into the table through... the data of a particular column in a table into drop down list dynamically
retrieve related data from database using jsp and mysql
retrieve related data from database using jsp and mysql  Hi sir, please give some example of jsp code for retrieving mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
JTable Display Data From MySQL Database
JTable Display Data From MySQL Database In this section we will discuss about... will describe you the displaying of data of a database table into a JTable...'s name and how to add data into the rows of table from database table
PHP List Box Post
The PHP Post List box is used in the form. It contains multiple value User can select one or more values from the PHP list Box This PHP Post List Box is the alternate of Combo box PHP Post List Box Example <?php
The code for retrieving data from database into Drop Down List.
The code for retrieving data from database into Drop Down List.  <% DataSource data = new MysqlDataSource(); Connection con... to MySQL"); PreparedStatement pre = con.prepareStatement("select * from
how to display data from mysql table in text box using jsp??
how to display data from mysql table in text box using jsp??  <p>hi, i have a written a code to display data from a mysql table into txtboxes...:mysql://200.0.0.153:3306/snms"; Connection connection = null; ResultSet rs=null
dynamic retrivel of data from mysql database in table format at jsp
dynamic retrivel of data from mysql database in table format at jsp  ... the data from database and display it as table format in jsp... For example, i have...... At jsp, if i choose A1 from the dropdown list then the corresponding details
how to store JTree data hierarchically in mysql database from netbeans
how to store JTree data hierarchically in mysql database from netbeans  how to store JTree data hierarchically in mysql database from netbeans. I am new to this topics so I need a program and tables you are using in database
PHP mysql database backup script - PHP
PHP mysql database backup script  How can i get the database backup using PHP mysql database
PHP list box
The PHP List box is used in the form. It takes input values from the user. The PHP List box contains multiple values at a time. PHP List Box Example <?php      if(isset($_GET['hobbie']))   
Search data from database - Java Beginners
Search data from database  Hi Deepak, This is not correct code I want this, Steps:- 1:- I hv a one form single name text box... searching)in name text box than all data should be displayed in another page related

Ads