Download presentation
Presentation is loading. Please wait.
Published byGrace Banks Modified over 8 years ago
1
>> PHP: File Uploads
2
Pre-requisite Go Online – Download file modify-item.php – copy it to your root folder (D:\xampp\htdocs\Buy4mMe) Web-Based Systems - Misbhauddin 2
3
Fill in the Products – Select Query List all the items from the database into the empty space shown below in the same format. Column 1 is a radio button and Column 2 is the name of the item. Hence, the value of column-1 (radio button) should be equal to the “id” of the product. List of items from the DB (Like stuff.php)
4
Page-Page Communication modify-item.phpupdate-item.php id of the selected item HOW? Recall the GET method How does it send values of the form to the PHP file Use that logic here too
5
Page-Page Communication modify-item.php update-item.php update-item.php?item=
6
Update Page: Retrieve current Info All information is filled from the database by executing a select query in the top with condition “where id = $_GET[‘item’].
7
Update Page: Execute update After the user changes the information and presses update Use the POST method to update the items by running the Update Query Display the message for success/failure selectively as we did earlier
8
Delete Query Within the same page as modify-item.php, write code for delete (use isset($_POST[‘delete’]) Run the Delete Query Display confirmation that the item was deleted successfully ISSUE: How to delete uploaded files? if(file_exists($img)) { unlink($img); }
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.