hi i have made a html page in which i have a drop down list whose code is

<p>Please select the product you want to add 
              <label>
              <select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
                <option>Nylon Blisters</option>
                <option>PP plastic</option>
                            </select>
              </label>
</p>

Now my main aim is that when a certain product is added and we enter it quantity its respective row in database is updated but i dont know how to get its value from form. so that i can update it

Recommended Answers

Firstly because you are using a form.. Make sure you declare your using one:

<p>Please select the product you want to add 
<form method="post" action="test.php">
              <label>
              <select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
                <option>Nylon Blisters</option>
                <option>PP plastic</option>
                            </select>
              </label>
              <input type="submit" name="submit" value="Update">
</p>

This code will just display the results …

Jump to Post

All 4 Replies

Firstly because you are using a form.. Make sure you declare your using one:

<p>Please select the product you want to add 
<form method="post" action="test.php">
              <label>
              <select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
                <option>Nylon Blisters</option>
                <option>PP plastic</option>
                            </select>
              </label>
              <input type="submit" name="submit" value="Update">
</p>

This code will just display the results of the form input.. But you can use '$name' to update your database:

<?php
	
	$name = $_POST['menu1'];
	
	echo $name;

?>

ok i hv tried that. is my this query correct when i want to add certain quanity to already stored quantity i database

$query= "UPDATE rpms SET (quantity=quantity+'$quantity') WHERE product_name='product_name'"

Not quite

$query= "UPDATE rpms SET quantity=quantity+'$quantity' WHERE product_name='product_name'"

i have solved it myself thnx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.