Comments (3)
make sure you have added query string parameters on links to update records e.g update.php?customer_id=61&operation=edit .
keep "name" attribute of input type same as database column name.
then use
$data_to_update = filter_input_array(INPUT_POST);
$db->where('id',$customer_id);
$db->update('customers', $data_to_update);
from core-php-admin-panel.
Hello Chetans9,
Thank you for your support and quick answer.
Done. I found the problem. I changed the value of "id" from a number to a Mac address but the FILTER_VALIDATE_INT was causing the problem.
Something new that I detected is that when you click on save button to save the changes in the MySQL table, in the php the changes goes back to the original.
from core-php-admin-panel.
Ok. I got it. Thanks for pointing it out. After Updating/Inserting Redirect to same page and show a session flash message.
Like this :
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$data_to_update = filter_input_array(INPUT_POST);
$db->where('id',$customer_id);
$stat = $db->update('customers', $data_to_update);
if($stat){
$_SESSION['success'] = "Customer updated successfully!";
header('location: customers.php'); //Redirect after successfull update
exit();
}
}
and whatever page you are redirecting Add something like this
if(isset($_SESSION['success'])) { echo '<div class="alert alert-success alert-dismissable"> <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a> <strong>Success! </strong>'. $_SESSION['success'].' </div>'; unset($_SESSION['success']); }
I was a newbie when I built this. I will fix it in later commits..
from core-php-admin-panel.
Related Issues (20)
- Fatal Error, please help HOT 1
- No Rate Limiting on "add_customer" functionality [Vulnerability]
- Not deploy installation guide HOT 2
- How to add new user ? No doc/guide HOT 6
- How to paginate from join 2 tables HOT 1
- Misspelling in helpers/helpers.php HOT 1
- distinct select method not working HOT 6
- checkbox values encountering error HOT 3
- register - super admin HOT 4
- need between condition query HOT 1
- Need to register user page HOT 8
- select values from database and show in a dropdown menu? HOT 1
- cant login HOT 1
- Admin update and create error HOT 1
- This part does Nothing HOT 1
- View record
- Add + Delete not working in PHP 7.4 HOT 1
- New admin-panel
- Super Admin HOT 3
- Potential security issue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core-php-admin-panel.