954,580 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

geting value from form

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

sidra 100
Junior Poster
142 posts since Dec 2009
Reputation Points: 6
Solved Threads: 0
 

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;

?>
phorce
Posting Whiz
362 posts since Jul 2011
Reputation Points: 31
Solved Threads: 26
 

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'"
sidra 100
Junior Poster
142 posts since Dec 2009
Reputation Points: 6
Solved Threads: 0
 

Not quite

$query= "UPDATE rpms SET quantity=quantity+'$quantity' WHERE product_name='product_name'"
simplypixie
Posting Pro in Training
447 posts since Oct 2010
Reputation Points: 116
Solved Threads: 82
 

i have solved it myself thnx

sidra 100
Junior Poster
142 posts since Dec 2009
Reputation Points: 6
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: