Ask Experts Questions for FREE Help !
Ask
    jayavani's Avatar
    jayavani Posts: 1, Reputation: 1
    New Member
     
    #1

    Mar 19, 2011, 11:16 AM
    how to do connection with drop down and text field
    hai... someone *** help me...
    Food_ID:
    Food_id :
    Food_Name :
    above is my interface... for the 1st food_ID I'm using drop down button... so now I want when I click drop down button it should fetch food_id from DB... ten when I select one ID... I wan the information about that ID show in 2nd food_id text field and the food name should appear in food_name text field... *** help...

    below I attach my code...
    **************************************…
    <?php
    include 'include/opendb.php';
    require_once("models/config.php");

    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-…
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>add new</title>
    </head>

    <body>

    <div align="center">WELCOME TO AMIGO WIRELESS RESTAURANT SYSTEM</div>
    <p align="center"> FOOD</p>
    <p align="center"><label>
    <div align="left">
    <p><strong>Food_ID: </strong>
    <select name="menu" id="menu">
    <?php

    $result = mysql_query('SELECT food_id , food_name FROM food') or exit(mysql_error());

    while ($row = mysql_fetch_assoc($result))
    {


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


    }
    echo '</select>';

    ?>
    </select>
    <p>Food_id :
    <input type="text" name="id"id"id" />

    <p>
    <p>Food_Name :
    <input type="id" name="name"text"name"name""name"form1" />
    <p>F

    <form id="form1" name="post" method="" action="center">
    <div align="submit">
    <input type="update" name="update" id="new" value="submit" />
    <input type="edit" name="edit" id="edit" value="reset" />
    <input type="clear" name="clear" id="clear" value="submit" />
    <input type="delete" name="delete" id="delete" value="center"> </p>
    </body>
    </html>
    **************************************…
    with above code I'm able to see food_ID in drop down button but I don't know how to pass that to text field...

    thanking in advance...
    rlerne's Avatar
    rlerne Posts: 10, Reputation: 1
    New Member
     
    #2

    Oct 22, 2011, 10:31 PM
    I'm finding it sort of hard to read your question, so hopefully I have this right.

    I'm thinking you want your drop down to show the food name, not the food ID number, correct?

    Easy solution. Here's the line you have:

    Echo '<option value="' . $row['food_id'] . '">' . $row['food_id'] . '</option>';


    Change it to this:

    Echo '<option value="' . $row['food_id'] . '">' . $row['food_name'] . '</option>';

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

To opt for the field which I have exp or to the field which is my actual background [ 0 Answers ]

I am a electronic engineer.Now I am pursuing my MBA in marketing(distance).I had 2 years of exp in telecommunication infrastructure(electrical) as site engg(electrical) with gross salary of 12k/month.Now I have recently changed to Business Development Executive in electronic sales of 10k/month, 3...

To opt for the field which I have exp or to the field which is my actual background [ 0 Answers ]

I am a electronic engineer.Now I am pursuing my MBA in marketing.I had 2 years of exp in telecommunication infrastructure(electrical) as site engg(electrical) with gross salary of 12k/month.Now I have recently changed to Business Development Executive in electronic sales of 10k/month, 3 months back...

Can I change my career into IT field, I've DCT quali, but 10 yrs exp in other field. [ 1 Answers ]

I'm into logistics field for 9 yrs. I hv passed 3yrs diploma in computer technology. Now I aspire to change my career into IT field. Can I? If so what course I should persume?

Wraping Text on a date field [ 1 Answers ]

I have a date cell formatted - mm/yy "Hours" - When I set the format to wrap text, then reduce the column width (and increase the cell hight to reveal multiple rows of text) I get ### error in the cell. Is there any way to wrap a numeric field? Thanks in advance, Jim


View more questions Search