PDA

View Full Version : How to pass variable to php



dusoo
11 Jun 2010, 12:51 AM
Hi everyone,

i have a grid displaying data from xml, which is build using php file.
I would like to add a combobox, and function "on change" which will pass data from it to that php file and reload my Grid.
I guess it is simple, but it's not working for me at all.

I would like to pass string from ComboValue variable into my report.php
But i don't get anything using $_GET['ComboValue'].

Thanks for any help
D.



var combo = new Ext.form.ComboBox({
...
})

var store = new Ext.data.Store({
url: 'report.php',
reader: new Ext.data.XmlReader({record: 'ROW'},
[
{name: "node", mapping:"NODE_NAME"},
{name: "util_in", mapping:"UTIL_IN"},
{name: "util_out", mapping:"UTIL_OUT"}
])

var grid = new Ext.grid.GridPanel({
...
});

combo.on('select', function(){
store.load({
params: {
ComboValue: combo.getValue()
}
});
});

steffenk
11 Jun 2010, 1:32 AM
use the change event of combobox, make an ajax request to receive what ever you need.

dusoo
11 Jun 2010, 2:50 AM
Im just trying to re-load the grid, using php file.
This code below should do this, no ? Send ComboValue to report.php...
store.load({params: {ComboValue: combo.getValue()}

Thanks

httpdotcom
11 Jun 2010, 4:58 AM
start with console (firebug is your friend). Use log() to make sure you are getting combo.getValue() correctly.
also, make sure the load call isn't getting "POSTed", by setting the method properly.
finally, look at using the default parameters of the select listener for combo (combo, record, index) to prevent scope issues.


combo.on( "select", function (c,r,i) {
if (!Ext.isIE) {
// can't see how combo is configured; do you need getRawValue() instead?
console.log( "load store with param : ",c.getValue() ) ;
}

store.load( {
method: "GET",
// can't see how combo is configured; do you need getRawValue() instead?
params: { ComboValue: c.getValue() }
} ) ;
} ) ;

ps. While your above code may not be complete, you are forgetting to close your store code properly (missing brace and parenthesis).