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

  • SEARCH
  • Home
  • 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 8432477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:08:12+00:00 2026-06-10T06:08:12+00:00

I am creating a form which has many dynamic dropdown.. values selected in first

  • 0

I am creating a form which has many dynamic dropdown..
values selected in first dropdown is passed to next and based on that value query is fired to the database and the next dropdown is filled with the data.. this process goes four time here..

for getting the value selected in the dropdown i have used javascript function for form submitting keeping my form action blank..

now when i get all the values i have to save this information to the database for that i need to pass these values to the next form but as my form action is blank it just reloads the page…

<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript" type="text/javascript">
function showproduct(product_name)
{
    document.frm.submit();
}
</script>
<script language="javascript" type="text/javascript">
function showpacking(batch_no)
{
    document.frm.submit();
}
</script>
<script language="javascript" type="text/javascript">
function showprice(packing)
{
    document.frm.submit();
}
</script>
</head>

<body>

<form action="" method="post" name="frm" id="frm">
<table width="500" border="0">
  <tr>
    <td width="119">Product Name</td>
    <td width="371">
    <select name="product_name" id="product_name" onChange="showproduct(this.value);">
    <option value="">--Select--</option>
    <?php
     $sql1="select distinct product_name from fertilizer";
    $sql_row1=mysql_query($sql1);
    while($sql_res1=mysql_fetch_assoc($sql_row1))
    {
    ?>
    <option value="<?php echo $sql_res1["product_name"]; ?>" <?php if($sql_res1["product_name"]==$_REQUEST["product_name"]) { echo "Selected"; } ?>><?php echo $sql_res1["product_name"]; ?></option>
     <?php
     }
     ?>
    </select>
    </td>
    </tr>
    <tr>
    <td>Batch No</td>
    <td id="batch">
    <select name="batch_no" id="batch_no" onChange="showpacking(this.value);">
    <option value="">--Select--</option>
    <?php
    $sql="select distinct batch_no from fertilizer where product_name='$_REQUEST[product_name]'";
    $sql_row=mysql_query($sql);
    while($sql_res=mysql_fetch_assoc($sql_row))
    {
    ?>
    <option value="<?php echo $sql_res["batch_no"]; ?>" <?php if($sql_res["batch_no"]==$_REQUEST["batch_no"]) { echo "Selected"; } ?>><?php echo $sql_res["batch_no"]; ?></option>
    <?php
    }
    ?>
    </select>
    </td>
  </tr>

   <tr>
    <td>Packing</td>
    <td id="packing">
    <select name="packing" id="packing" onChange="showprice(this.value);">
    <option value="">--Select--</option>
    <?php
    $sql2="select distinct packing from fertilizer where product_name='$_REQUEST[product_name]' and batch_no='$_REQUEST[batch_no]'";
    $sql_row=mysql_query($sql2);
    while($sql_res2=mysql_fetch_assoc($sql_row))
    {
    ?>
    <option value="<?php echo $sql_res2["packing"]; ?>" <?php if($sql_res2["packing"]==$_REQUEST["packing"]) { echo "Selected"; } ?>><?php echo $sql_res2["packing"]; ?></option>

    <?php
    }
    ?>
    </select>
    </td>
  </tr>

   <tr>
    <td>price per unit</td>
    <td id="price">


    <?php
    $sql3="select distinct rate_per_unit from fertilizer where product_name='$_REQUEST[product_name]' and batch_no='$_REQUEST[batch_no]' and packing=$_REQUEST[packing]";
    $sql_row=mysql_query($sql3);
    while($sql_res3=mysql_fetch_assoc($sql_row))
    {
    ?>
    <input type="text "name="price" id="price" value="<?php echo $sql_res3["rate_per_unit"]; ?>" >
    <?php
    }
    ?>
    </td>
  </tr>


   <tr>
    <td>
    <input type="submit" name="Save" value="save">
    </td>
  </tr>

  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
  • 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-10T06:08:14+00:00Added an answer on June 10, 2026 at 6:08 am

    Replace

    <input type="submit" name="Save" value="save">
    

    with something like:

    <input type="button" name="Save" value="Save" 
    onclick="
    document.getElementById('frm').action = 'next_form.php' ;
    document.getElementById('frm').submit();
    "/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem in creating an AJAX-based form submission which if its response
I am creating a registration form which contains two submit buttons. I need to
I am creating one form in html using table. Which have one Drop down
I am creating a form designer. It will generate PHP code which will produce
I am creating an iPad app which is a form with mostly text boxes.
I frequently find myself creating classes which use this form (A): abstract class Animal
I am creating an user registration form using jsp,in which there is an option
In my form fancy select boxes are used. Which resulting in creating some spans
I have a jQuery Model windows which contains a form. On creating of the
What is the best way of creating and populating an Object from values passed

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.