Home Answers Viewqa PHP displaying data for a single column from Mysql database in the list box in php form

 
 


swapnali
displaying data for a single column from Mysql database in the list box in php form
4 Answer(s)      a year and 10 months ago
Posted in : PHP

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 Pages:
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
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
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
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... strQuery = "select file_data from file where id="+id; ResultSet rs
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
displaying image
displaying image  how to upload image and retrieve it form database mysql in php?   Here is an example of uploading image using php. 1)form.html: <form method="post" enctype="multipart/form-data" action="upload.php
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
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
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
Displaying Database using PHP
PHP DATABASE Part-5(d) : Displaying Data (with the help of PHP Scripts) Till... with the help of PHP Script. Let's see the following steps to displaying the data... is to assign the values of the form in the variable and insert into the database
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
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
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
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
PHP Tutorials from RoseIndia
and html form using PHP.   PHP MySQL Connect to a Database... from your database in a drop down menu/list box. You can apply... as well as value. PHP Create a Shout box using MySQL
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
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
displaying data
displaying data   how to display data from database on jsp using struts2
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']))   
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from ms sql 2000 database into an html form text box and text area, using java..."); out.println("Display Data from Database"); out.println(""); out.println
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
List Box - JSP-Servlet
list box.on selecting one value in list box,i will retrieve values from database and store into another list box in same page using javascript :location.my problem is in first list box,value which i selected to get values is not displaying
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
Displaying Database information on the browser.
PHP DATABASE Information Part-5(b): Displaying Data (with the help.... Let's see the following steps to displaying the data on the website : 1. First... ?> B. The second step is to hold the data sent from the contact.php
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
PHP MySQL Login Form
Login Form using PHP and MySQL: In any website generally it is mandatory to have a login form to keep your data secure. In this regard we need to have... will study how to create a login form, connect with the database server and login
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
JSP Get Data Into Dropdown list From Database
data from the database and set it into the dropdown list in JSP using MySQL...JSP Get Data Into Dropdown list From Database In this section we will discuss.... This tutorial explains you that how to fetch data from database and set
JTable Display Data From MySQL Database
JTable Display Data From MySQL Database In this section we will discuss about how to display data of a database table into javax.swing.JTable This section will describe you the displaying of data of a database table into a JTable
Remove Unique Column in Database Table
affected. After removing the unique column from Database Table: Student Table... Remove Unique Column in Database Table   ... unique field of the particular column in a database table.  We know
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
PHP Displaying URL Content
PHP Displaying URL Content  In my PHP application form, on submitting the form details it always displaying url content. Can anyone tell me what is the reason and how to restrict it from displaying
php
php  plz tell me code for PHP SQL Insert,delete,update,view is used to insert the record from HTML page to Mysql database using in single PHP form
Displaying Mysql clob data using Servlet
Displaying Mysql clob data using Servlet .In this Section, we will display a clob data from a table of database using servlet. A CLOB is a Character Large Object in a Database table. CLOB data is used to store a block of text
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
image displaying from database with some other information
image displaying from database with some other information  hi, in the following section of code when i am not displaying the image it is working... only a cross mark is shows. same code runs if i am not retriveing any data from
Javascript List Box - JSP-Servlet
on given semester from oracle database and the result is displayed in same page itself.my problem is in list box the semester which i selected is not showing in list box as selected.when i select,the page refreshes but i get the result what
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
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
dynamic retrival of data from mysql database to dropdownlist in jsp
dynamic retrival of data from mysql database to dropdownlist in jsp  Hello, Am having problem in my project... i want to retrive the data from mysql... of dept from the database to the dropdown list... if i select the particular dept
Delete a Column from a Database Table
Delete a Column from a Database Table   ... to delete a column from a database table. We are not going to create a new table... a column from a database table then we have been provided with the  database
database and php
database and php   suppose i have five tabels and i must form them... in html or php and insert the form value to the msyql database. or some thing else you want. you want to retrieve the data from mysql or something else you want
jsp list box - Java Beginners
jsp list box  I have two list boxs. the values for the first list box is retrieved from the mysql database. I want to fill the second list box selected item from the database. Please help me in this regard. Your help
Setting up the database in PHP
an example : you can tell PHP to go and look into the database for a list...PHP DATABASE Setup Part-5(a) : Setting up the database In this chapter, we will tell you how to create a database and tables in MySQL and also how
Welcome to the MySQL Tutorials
the data from MySQL database in JSP page.  ... in MySQL. The identifiers are Database, table, index, column and alias name... how to create a web database application using PHP and MySQL

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.