Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

Have Programming Question? Ask it here!
 
 
 


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


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


Advertisement
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
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
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
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
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
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
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
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
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
php form post to mysql
php form post to mysql  How to post data into mysql database from the PHP post data form
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
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 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
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.. 
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
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
php import data from excel to mysql
php import data from excel to mysql  php import data from excel to mysql
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
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
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
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
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
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
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
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
view data from database using drop down list
view data from database using drop down list  hi i want to view the data from database by selecting a value in a drop down list. for an example drop down list have picture element.when click it select pictures from the database
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
how to add data dynamically from database into a dropdown list in a jsp
how to add data dynamically from database into a dropdown list in a jsp ... in storing them into the database,this registration form contains name... get dynamically from the database and whenever a new person has registered his
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 List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List of records from database in a jsp using ajax, onclick it should display the results
how to insert list box in java script dynamically and elements retrieving from database like oracle
how to insert list box in java script dynamically and elements retrieving from database like oracle  Hi, how to dynamically increase size of list box in javascript when elements retrieving from database.. That is whenever I
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
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
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
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 insert list box in java script dynamically and elements retrieving from database like oracle
how to insert list box in java script dynamically and elements retrieving from database like oracle  hi all, how can i insert elements into java script list box retrieving from Database. whenever I insert any element in the Db
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
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
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
 

 

 

DMCA.com