| | |
how can i make a window close itself after running the php code
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Apr 2009
Posts: 281
Reputation:
Solved Threads: 2
0
#11 20 Days Ago
•
•
•
•
You'd have this kind of setup
First the Index page
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
//fake display structure <ul> <li>Item 1 - <a onclick="return confirm('Are you sure?')" href="delete.php?id=1">Delete</a></li> <li>Item 2 - <a onclick="return confirm('Are you sure?')" href="delete.php?id=2">Delete</a></li> <li>Item 3 - <a onclick="return confirm('Are you sure?')" href="delete.php?id=3">Delete</a></li> <li>Item 4 - <a onclick="return confirm('Are you sure?')" href="delete.php?id=4">Delete</a></li> </ul>
Now the delete page
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<?php $id = isset($_GET['id']) ? intval($id) : 0; if ($id) { //just some validations //do delete commands header("Location: index.php"); //It's important that you haven't output anything upto this point } ?>
This way there are no new windows or popups.
If you want users to be able to delete multiple messages at once, you'd have to modify the code so that users can select which messages are to be deleted. You can use an array of checkboxes for this and modify the delete code to work with an array. But then you'd have to use a FORM element to submit. That's another topic, some info can be found here
i just need to remember than darn redirect code... with js. dangit
•
•
Join Date: Oct 2009
Posts: 99
Reputation:
Solved Threads: 18
0
#12 20 Days Ago
The header used there is the PHP header command, It will work. If you need to know where you came from you can pass a variable or look at th PHP referrer. Javascript won't help you there I'm afraid.
Anyway, these were just some tips, you don't need to switch to it if it messes up your existing code. As long as it gets the job done
Anyway, these were just some tips, you don't need to switch to it if it messes up your existing code. As long as it gets the job done
![]() |
Similar Threads
- window.close() problems (JavaScript / DHTML / AJAX)
- xampp not running php as well as html files (PHP)
- Delay Window Close (JavaScript / DHTML / AJAX)
- site will not display php, only the code contents (PHP)
- Problem closing Browser with Window.Close (ASP.NET)
- Using HTML tags in PHP code (PHP)
- How to close IE without a user dialog box? (JavaScript / DHTML / AJAX)
- How to test PHP code in offline in Linux + Apache 2 (PHP)
- My embedded php code won't execute (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Warning Message on Browser Close
- Next Thread: Get, show PDF, JPG, Video
| Thread Tools | Search this Thread |
2.0 adobe adobereader advanced ajax array asp.net automatically basic beginner c# cart checkbox class cms curl database delete display dom download dynamic email file files firefox flash form forms forum function hosting html htmlform ibm iframe image images include insert java javascript jquery jsp key keywords lamp limit link login mail masterpage memmory menu mp4 multiple mysql news number oop open paypal pdf php post problem query script scriptlets search security select seo sharepoint shopping sms software sorting spam sql table tutorial unicode up-to-date upload validation variable video virus vulnerability w3c web websitecontactform window windowofwords wpf xp ydn youtube zend






