Add values of drop down menu( select option) to mysql table

Ads
 

Add values of drop down menu( select option) to mysql table

Here is my code

    <?php    
    echo $row['valveName'].'<td>'.$row['valveId'].'<td>';
    echo '<select name="onoff">';
    echo '<option  value="ON">ON';
    echo '</option>';
    echo '<option value="OFF">OFF';
    echo '</option>';
    echo '</select>';
?>
    <tr>
    <td>
    <input type="submit"  name="Submit" align="bottom" border="2" >
    </tr>
<?php
if (isset($_POST['Submit'])) {

    $change=$_POST[onoff];
    echo $change;
}
    /* $selection=$_REQUEST[onoff];
    switch($selection)
    {
    case "1" :
     $change="ON";

    echo $change;
    break;
    case "2" :
    $change="OFF";
    echo $change; 
    }
     */
  $query_auto="UPDATE valve set position='".mysql_real_escape_string($change)."' where valveName='$select1'";
    mysql_query($query_auto) or die(mysql_error());42

but $change has a null value

thanks

View Answers

Ads









Related Tutorials/Questions & Answers:
Add values of drop down menu( select option) to mysql table
Add values of drop down menu( select option) to mysql table   Here...['valveId'].'<td>'; echo '<select name="onoff">'; echo '<option value="ON">ON'; echo '</option>'; echo '<option
want to insert values in drop down menu in struts1.3
want to insert values in drop down menu in struts1.3  I am using DynaValidatorForm.please help me with inserting values in color drop down menu. I... <?xml version="1.0" encoding="UTF-8"?> <!-- Document : add
Advertisements
drop down menu
drop down menu  drop down menu using html
Drop down menu
Drop down menu  I have drop down list of some 14 links which links to the table,If i click each link the table should display below the link and again if i click the link the table should not appear. please help me
Drop down menu
Drop down menu  I have created a drop down list of links which links to a table but if i click the link the table display in the other page i want to display it in the same page.Please tell me the solution
JSP Dependent Drop Down Menu
JSP Dependent Drop Down Menu  Hey Guy/Gals! I need someone help to guide me in creating a drop down menu, where the first menu affects the second menu and it's selection. So in my database I have a category table that has a ID
Get values in drop down list
Get values in drop down list  Pls provide me jsp code to get values in drop down list from another table's field. my project has customer... in drop down box in front end..... pls provide me code.. thanx
Pls provide me jsp code to get values in drop down list from another table's field....
Pls provide me jsp code to get values in drop down list from another table's field....  my project has customer registration and company registration... in customer registration page and should be shown in drop down box in front end
html menu button drop down
html menu button drop down  How to create a menu button in HTML?   <select id="category"> <option value="1">One</option> <option value="2">Two</option> </select> <select id
Add/Remove Rows Dynamically with drop down list in html table using php
Add/Remove Rows Dynamically with drop down list in html table using php  Here Is My Code. I want to give and get the id of drop down list. Can Anyone..."); $result=mysql_query("select * from test"); while($row
drop down php mysql - PHP
drop down php mysql  PHP Script required to show the similar drop down item in each menu without refreshing the page. Is it possible if yes how
Login With Drop Down, Having Departments in different table
to login when I select department from the drop down list. Since I cannot populate the departments name from each table into drop down I use Select tag and declare... is to select the department from the drop down box and then login to the page. I
store values of drop down list box in database
store values of drop down list box in database  how to store values of drop down list box in oracle database in jsp?I have information inserting form where i have date of birth as drop down list box
display table details when selecting table name in drop down liat
display table details when selecting table name in drop down liat  Hello, Am having problem in my project... i want to retrive the data from mysql... of tables from the database to the dropdown list... if i select the particular table
how to retreive data dynamically from mysql to drop down list
how to retreive data dynamically from mysql to drop down list   sir, i created a table in mysql and i inserted some values into the table through... the data of a particular column in a table into drop down list dynamically
mysql alter table add column
mysql alter table add column  Hi, What is the syntax of mysql alter table add column? Thanks   Hi, Here is mysql alter table add column example: ALTER TABLE employee ADD address VARCHAR(50); Read more at MySQL Add
How to display all the Select values from the MySQL database table in where condition= In JSP?
How to display all the Select values from the MySQL database table in where... to display all the select values from MySQL DB** only first value is displayed in the jsp file. @select * from table dept where dept_no=10;" jsp code i have used
how to import values from database to the drop down box
how to import values from database to the drop down box   hi iam... employee page i kept a drop down box for employee Ids i want all employee IDs will display in the drop down box please help me with the code
Dynamic Dropdown Menu
records from your database in a drop down menu/list box. You can apply... a table in your desired database,  you can create and insert values using... is open the mysql console and type the following: create table car_list (c_id int
mysql alter table add unique constraint
mysql alter table add unique constraint  How to add mysql alter table add unique constraint in mysql table. Thanks   Hi Following query query can be used: ALTER TABLE mytable ADD CONSTRAINT uc_key1 UNIQUE
mysql alter table add multiple columns
mysql alter table add multiple columns  Hi, I have a table in database. I want to add multiple columns into existing table. What is the code for mysql alter table add multiple columns? Thanks   Hi, You can use
alter table add foreign key mysql
alter table add foreign key mysql  Hi, How to add foreign key in mysql using the query 'alter table add foreign key mysql' Thanks   Hi, We can use the following query: ALTER TABLE emp_address ADD FOREIGN KEY (emp_id
mysql select into table from another table example
mysql select into table from another table example  Can you suggest the correct example of select into table from another table example in MySQL... from one table into another table. Check the example at MySQLselect into new
Mysql Drop
Mysql Drop       Mysql Drop is used to remove or delete the table from the database. Understand with Example The Tutorial illustrate an example from 'Mysql Drop'.To understand
Mysql Alter Drop
Mysql Alter Drop       Mysql Alter Drop is used to modify the table definition and delete... an example from 'Mysql Alter Drop'. To understand this example, we create a table
Drop Table
Drop Table       Drop Table in SQL get rid of an object or table from the database. Using a drop Query... from database. The Drop table cannot get it back, once you run the drop Query
how to dynamically add text boxes with add and remove link based on drop down choices, if a particular choice is selected.
how to dynamically add text boxes with add and remove link based on drop down choices, if a particular choice is selected.  how to dynamically add text boxes with add and remove link based on drop down choices, if a particular
drop down
drop down  how can i add data from choice/dropdown component of java awt to myaql table
dynamic drop down
dynamic drop down   I have created 2 drop downs in jsp.1... into the designation drop down (use jsp+javascript+servlet) reply soon   1...; <select onchange="showDesig(this.value)"> <option value="none
Dependant & dynamic drop down list
on the values selected by user in first drop down list. How to achieve this ?   ...`));   This will select only ONE row (country) from first drop down. In my case...Dependant & dynamic drop down list  I don't know this should
Select from drop down and load the appropriate application resource.properties in struts2
Select from drop down and load the appropriate application resource.properties in struts2  I would like to use a dropdown for selecting a language in my application .On selecting a language the appropriate

Ads