Jump to content

Retrieve the data from database and display it in a drop down menu and again use the same as form input in php


Recommended Posts

As a complete newbie to php and webdesigning i have a following problem.I would like to retrieve the data from database and display it in a drop down menu.Then i should allow the user to select the values from drop down list along with other details,in other words i have to embed the drop down output as the form input for the user and store the form data in another table.I am running a xampp server and i am using php 5.4 version.Please help.My code is as follows.In this case project_name is displayed as the drop down output.but how do i use the same drop down output as a input in the form.
error_reporting(E_ALL ^ E_DEPRECATED);
include 'connect.php' ;

$sql="SELECT project_name FROM $tbl_name ";


if($result === FALSE) {

<form name="resources" action="hourssubmit.php"  method="post" >

echo "<select name='project_name'>";
while ($row = mysql_fetch_array($result)) {
    echo "<option value='" . $row['project_name'] ."'>" . $row['project_name'] ."</option>";
echo "</select>";


Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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.