| | |
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 19 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 19 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 |
action adobe ajax api array automatically basic beginner c# cart checkbox class cms codes combobox confirm curl database debugger developer developers display dom eclipse email execute explodefunction ext file files firefox flash flex folder form forms griefers gxt hackers head html iframe image images include indentedsubcategory innerjoins java javascript joomla jquery js jsp lamp link linux local login mail malfunctioning matching menu multiple mysql news oop open paypal pdf php play post problem protocol query regex script scroll search security select shopping sms spam sql tag tutorial unicode upload validation vbulletin video web webdesign window windows wysiwyg xml youtube zend






