Skayfer Posted January 22, 2016 Share Posted January 22, 2016 (edited) Hi, I am working with my simple module and i have next problem, that i can't understand. In module config page i have to forms. First display something from db in inputs and works great. When i change something in input and not click save (submit this form), change wouldn't be save in db, when i click save all inputs are update, great. But in second form, that i use to add new rows in db is problem. When i am in new tab in this config page and realod my page nothing happens. But when i only once type something to inputs second form, click this submit, it looks like vars are not cleared. Now if i reload page 10 times i will have 10 new field, although i don't click submit. code from get Content function: $new_field_title = null; $new_field_value = null; if (Tools::isSubmit('add_new_field')){ $new_field_title = strval(Tools::getValue('new-field-title')); $new_field_value = strval(Tools::getValue('new-field-value')); if( !$new_field_value || empty($new_field_value) || !Validate::isGenericName($new_field_value) ||!$new_field_title || empty($new_field_title) || !Validate::isGenericName($new_field_title) ){ } else{ $sql = "INSERT INTO "._DB_PREFIX_."fields (title, value) VALUES ('".$new_field_title."','".$new_field_value."')"; Db::getInstance()->Execute($sql); } } Edited January 22, 2016 by Skayfer (see edit history) Link to comment Share on other sites More sharing options...
Skayfer Posted January 24, 2016 Author Share Posted January 24, 2016 Someone can help ? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now