PDA

View Full Version : Form Submit Issue.



border9
25 Jun 2009, 5:57 AM
buttons : [
{
text : 'Save',
iconCls : 'save-icon',
handler : function(){
formPanelw.getForm().submit({
url :'php/uploader.php',
waitTitle :'Connecting',
waitMsg :'Uploading your file...',
success : function(){
readerStore.reload();
msg('Success', 'Your file was added to the database!');
formPanelw.getForm().reset();
win.drawers.w.hide();

},
failure : function(){
var error = action.result.message;
msg('Error', error);
fp.getForm().reset();
}
});
}
},
{
text : 'Cancel',
handler : function() {
win.drawers.w.hide();
}
}
]
});The issue im having is every time i run this script it comes up success, here is the php that goes along with it, ive crossed off almost everything just trying to get it to break.


if(isset($_FILES["photopath"])) {
$orgName = $_FILES["photopath"];
$itemName = $_REQUEST['name'];
$itemLevel = $_REQUEST['level'];
$lastChange = $_REQUEST['change'];
$itemComment = $_REQUEST['comment'];
$itemType = $_REQUEST['type'];

if($orgName == '' ) {
echo "{failure: true, message: 'You must select a file to upload!'}";
exit();
}
if($itemName == '' ) {
echo "{failure: true, message: 'You must enter a Name for your file!'}";
exit();
}
if($itemLevel == 'Select ...' ) {
echo "{failure: true, message: 'You must select a item level!'}";
exit();
}

// $sql_get_quote_num = "SELECT max(quote_number) as NUM FROM quotes";
// $quote_num_result [email protected]_query($sql_get_quote_num);
// while($row = @mysql_fetch_array($quote_num_result))
// {
// $quote_number = $row['NUM'];
// }

// Add 1 to the existing count
// $quotenum = $quote_number + 1;

// $timeadjust = -15 * 60 * 4;
// $agent = $_SESSION["auth_username"];
// $date_time = date("Y-m-d h:i:s a",time() - $timeadjust);
// $date = date("Y-m-d");
// $site_tag = "Agent Custom Add by";
// $customer_type = "Custom Inputed Quote";

// $query .= "INSERT INTO tester(org_name,image_dir,thumb_dir,image_desc)";
// $query .= "VALUES('$orgName','Dir Normal','Dir Small','$itemComment')";
// $result = mysql_query($query);

if (mysql_query($sql))
{
echo "{success: true}";
}
else
{
echo "{failure: true, message: '" . mysql_error() . "'}";
exit();
}
}

Ive been reading over the forums for the last 2 hours and trial and error this thing, but for the life of me i cant come up with a fix.

Any help would be greatly appropriated, Thanks

BitPoet
25 Jun 2009, 8:35 AM
Try "{success: false, message: '...'}" as shown in the Ext.form.Action.Submit (http://extjs.com/deploy/dev/docs/?class=Ext.form.Action.Submit) docs.