0

i want if user select one value in combo box that value should store in db and then display what they are selected. for example if user select CONFIRM option that value stored in db after that it display CONFIRM instead of that combo box form and button. Here i can stored the combo box values in db successfully. thats not a problem and then here i used ajax method to show the msg instead of button place. Now, i want what user select it should display the same value. check these above coding and reply me ur suggestions...

this is my combo box page coding:

<?php
echo "<form method=post align=center>
<div id=myDiv>
<select name=userselect>
<option value=empty></option>
<option value=Confirm> Confirm </option>
<option value=Processing> Processing </option>
<option value=Pending> Pending </option>
<option value=Cancelled> Cancelled </option>
</select>
<button type=button name=combobox value=combobox onclick=loadXMLDoc()>Update</button>
</div>
</form>";
?>

this is my php code (another page):

<?php
if (isset($_POST['combobox']))
{
    $userselect = $_POST['userselect'];
    echo $userselect;
}
?>
2
Contributors
2
Replies
13
Views
3 Years
Discussion Span
Last Post by hag++
0

Ok well it sounds like you already have the server side/ajax setup so all you have to do is attach an onChange listener to the select element.

var select = document.getElementById('select_id');
select.onChange = function() {
    // Get the selected value
    var value = this.options[this.selectedIndex].value;
    // Process change event
};
0

Also it's best practice to wrap all values to element attributes in double quotes.

<form method="POST" action="/myaction.php">

</form>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.