Home Answers Viewqa PHP Add values of drop down menu( select option) to mysql table

 
 


Devika Pathirana
Add values of drop down menu( select option) to mysql table
0 Answer(s)      2 years ago
Posted in : PHP

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









Related Pages:
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
jsp drop down-- select Option
jsp drop down-- select Option  how to get drop down populated...;nbsp;</td> <select name="sel"><option value=""><---Select..."); String buffer="<select name='state'><option value='-1'>Select<
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
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
select option value
select option value  if i select a value of any drop down...("Select * from country"); while(rs.next()){ %> <option value... id='state'> <select name='state' > <option value='-1
select option value
select option value  if i select a value of any drop down then that value should be used in a select query of the next dropdown in jsp on same page... buffer="<select name='state' ><option value='-1'>Select</option>
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
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
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
drop down menu
drop down menu  drop down menu using html
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
drop down
drop down  how can i add data from choice/dropdown component of java awt to myaql table
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
Dependent drop down list
Dependent drop down list  hi,i am trying to design a form on which 2 dependent drop down list is used my code is successful but when i select class from first drop down list all the data get lossed means the value entered
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
jQuery Drop Down Menu
jQuery Drop Down Menu       In this JQuery tutorial we will develop a program  to make Drop Down menu Steps to develop the Drop Down menu . Step 1:         Create
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
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
Drop down list from database
Drop down list from database  Hi, Can I know how do we get the drop down list from database? Eg: select country--select state--select district--so...; <select name='state' > <option value='-1'><
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
Login With Drop Down
a drop down list consisting of Customs and Accounts. I have user accounts of both the departments. Now, my intention is to select the department from the drop down...Login With Drop Down   Hi all, I am doing a project using JSP. My
Ajax drop down and textbox
Ajax drop down and textbox  hie frnds I have a dropdown menu in the 3 options(1,2,3) are there if i choose 1 then I should get 1 text box if i select... menu consisting of options 1,2,3. When the user select any option from
Dependant & dynamic drop down list - Follow up
Dependant & dynamic drop down list - Follow up  Thanks for your answer. As per your answer This will select only ONE row (country) from first drop..."); String buffer="<select name='state' ><option value='-1'>Select<
How to add another option to the select tag using struts2 tag - Struts
How to add another option to the select tag using struts2 tag  Hi, How to add another option to select tag using tag. My scenario is : If the logged in user is admin then drop down should contain the normal list
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); add(form); } private void doupdate() { //String
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); add(form); } private void doupdate() { //String
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); add(form); } private void doupdate() { //String
insert data using drop down box in java into database postgresql
insert data using drop down box in java into database postgresql  can... data into database using an drop down box .....as i m using eclipse as jdbc...); add(form); } private void doupdate() { //String
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
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
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
JSF Select one menu - Framework
JSF Select one menu  Hi, I am new in Jsf, I use one this is based on some table in MySQL, Data is coming in this select box, but I want also show â??selectâ?? option in first position. I also use above This is giving
how to set a value of dynamic number of drop down lists on a jsp page and access it value on another jsp page
one setting values of drop down lists and other one accessing it in this jsp i m accessing values of rating1,rating2.... which are names given to drop down...how to set a value of dynamic number of drop down lists on a jsp page
jsp login code ... when username , drop down box and password is correct
value is correct.... the drop down box values should be retrieved from database...jsp login code ... when username , drop down box and password is correct ... type="password" name="pass"></td></tr> <tr><td>Select
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
jQuery Simple Drop Down Menu
jQuery Simple Drop Down Menu In this section, you will learn how to develop a simple drop down menu using jQuery. To develop a drop down menu we put... color="green"> Hover mouse on any menu item to drop down
Drop Down reload in IE
Drop Down reload in IE  Hi i was using two drop down box..One for Displaying date followed by another for Dispalying Month..If i Select/Change Month from the 2nd drop down then the 1st drop down ( which is date) automatically
validation for drop down list
validation for drop down list  Hi all I have a form, it contain 12 drop down list. Each drop down has 1 to 5 values,i need to validate this form. the following condition should be true. 1.you can choose only 3 times 5 value. 2
Drop down and radio button value on edit action
Drop down and radio button value on edit action  HI, I have a title field and a payment type field for title i have used drop down with values...; by cheque When 'm adding a new customer it works fine as we have to select
Drop-down text selection in jsp/html
. Now the first dropdown will have all the values. The second drop-down depends upon...Drop-down text selection in jsp/html  Hi, I am trying to create JSP... such dynamic dropdowns. Also based on the values selected in the drop-downs, I should
creation of drop down menu using ajax in java - Ajax
creation of drop down menu using ajax in java  Hi, Here I want to create a drop down menu using ajax in ofbiz framework. I want to fetch the data from database.I got examples using asp.net and php but I am not getting
dependent drop down box - JSP-Servlet
dependent drop down box  haloo sir Please give me the solution how to extract data from dependent drop down box with page refresh...?book="+bookname); } --Please Select-- "> --Please
Drop down combos
Drop down combos  Hi.. How to write a javascript for linked combo...="combo1" onchange="change(this);"> <option value="0">-Select-</option>... language="javascript"> var arr = new Array(); arr[0] = new Array("-select
dynamic drop down list
dynamic drop down list  I want to create 2 drop down list, where it takes value from database and the two list are dependent..means if I select a particular value from one the other list is developed accordingly..depending
MySQL Add Column
MySQL Add Column       MySQL Add Column tutorial explains you to add the column to the existing... add the new column  in a table using add  keyword in the query
Mysql Alter Table Primary Key
Mysql Alter Table Primary Key       Mysql Alter Table Primary Key is used to remove the primary key from the table and add primary key to the existing other column of table
select option with text facility - JSP-Servlet
select option with text facility  Hello. My doubt is regarding how to provide facility to add text in a drop down box ie(select tag in html )in a jsp page. Consider we have a drop down list which is dynamically displayed using
Excel Cell Drop Down List
Excel Cell Drop Down List In this section, you will learn how to validate data entered in a cell and provide a drop down list of possible values to the user... the following error message : You can select the value from the drop down

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.