Is it possible to display one value and send another value at the same time in Input text field?
For example 2
is the current value shown in <input>
box when i onchange
the <开发者_开发问答;select>
box.
Now I need to send the value 3
for that <input>
box but need to display 2
.
Example:
<input type="text" value="2" name="test1">
should display 2
in the page and need to pass 3
to next page.
If I echo $_POST["test1"]
it should print 3
.
try this (if i understood your question correctly):
$('select').change(function(){
var val = this.value;
$('input.select').val(val);
})
and here is the fiddle: http://jsfiddle.net/maniator/hp8cr/
ON QUESTION UPDATE
Why not on the PHP side just add one to the post:
echo ($_POST["test1"] + 1);
If you are using jquery and ajax post, you can achieve this.
$.post("myscript.php",
{ test2: $('#test2').val(val), // Submit normally
test1: '3' // Change the value
},
function(data){
// Handle response here
});
)
精彩评论