You can do this by running a Ext.Ajaxquery.
Suppose your form has 3 fields: -
- Title (
textfield) - Password (
passwordfield) - Age (
numberfield)
You will get the values of these fields as shown below,
.....
.....
{
xtype:'button',
id:'submitBtn',
text:'Submit',
ui:'confirm',
listeners : {
tap : function() {
var form = Ext.getCmp('form-id');
var values = form.getValues();
Ext.Ajax.request({
url: 'http://www.servername.com/insert.php',
params: values,
success: function(response){
var text = response.responseText;
Ext.Msg.alert('Success', text);
}
failure : function(response) {
Ext.Msg.alert('Error','Error while submitting the form');
console.log(response.responseText);
}
});
}
}
....
....
, , insert.php .
<?php
$con = mysql_connect("server","username","password");
mysql_select_db('database_name',$con);
$insertQry = "INSERT INTO tableName(name,password,age) VALUES ('".$_POST['name']."','".$_POST['password']."','".$_POST['age']."')";
if(mysql_query($insertQry))
{
echo('success');
}
else
{
echo('failure' . mysql_error());
}
?>