Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9005587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:11:09+00:00 2026-06-16T01:11:09+00:00

I have a database named Data which has a table in which their are

  • 0

I have a database named Data which has a table in which their are different names of products their id and prices, i want to make a web page using php so that i can edit,add and save the items from the web page to the DB and search the names accordingly.

  <html>
  <head>
 <title>Products store</title>
  </head>
  <body>
  <p  style="font-size:20px" align="center"> <b>Product Database Editor</b> </p>
  <p>
  <form method="post">
   Enter Product Name: <input type="text" name="pname" id="pname" size="70">
 <input type="submit">
  </p>
 <form method="post">
<select id="opt" name="opt">
   <?php
$pname = $_REQUEST['pname'];

// $pname= mysql_real_escape_string($_POST['pname']);

 $con = mysql_connect("localhost","root","");
 if (!$con)
    {
     die('Could not connect: ' . mysql_error());
      }
     mysql_select_db("Dataentry", $con);

      $result = mysql_query("SELECT * FROM products where name like '%$pname%'");
      $result_rows = mysql_num_rows($result);

      if($pname==NULL)
        {
        echo "Please enter a product name!";
          }
      else if($result_rows==0)
        {
      echo "Product Name does not exist!";
        }
     else
        {
        while($row = mysql_fetch_array($result))
         {

     $name = $row['name'];

     echo "<option value='$name_selected'>$name</option>";

   //echo ("<option value = '" . $row['name'] . "'>" . $row['id'] . "</option>");

      echo $name_selected;  


 echo "<br />";
 }
 }
 mysql_close($con);


  ?>
 </select>
  </form>

  </body>
   </html> 

when i run this code i get the names list in the dropdown but after i select any name, nothing happens, how should i modify my code so that i can select any name from the dropdown and then be able to fetch the price of that particular name to edit it.
please help, coding will be much helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T01:11:11+00:00Added an answer on June 16, 2026 at 1:11 am

    Suppose you have a question like this in your dropdown menu.

    Q - How many colors does the US flag has?

    Now, from what I understand you want your choice from the drop down menu to appear instantly..

    Well, here is a simple select form.

    <form method="post">
    <select id="opt" name="opt">
        <option value="four">four</option>
        <option value="five">five</option>
         <option value="two">two</option>
         <option value="million">million</option>
    </select>​ 
    

    And, the JS code:

    $(document).ready(function() {
        $("#opt").change(function() {
            alert($(this).val());
        });
    });​
    

    Now, click her a DEMO with jsFiddle to show you, how it works.
    You can copy/paste the codes and include them in your site, this is a simple code, but you if you small knowledge of Javascript you can manipulate the data the way you need it to appear. .

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple database named customer with a single table data.I want to
I have a table in database which has following structure(data) : +--------------------------+ Organization +--------------------------+
I have a table in my database which has duplicate records that I want
I have a database named contacts.db with a table named TABLE_NAME that has one
I have a database named Tamaris, which contains a table User. I created a
I have a database table named Categories . I want to create a form
I have a database table named 'student' in which there is one column named
I have Linq-to-SQL code here which submits data into the database in their respective
I have two tables in my database named...Requests and Balance tracker which has no
I have two tables in my database named...Requests and Balance tracker which has no

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.