no.. if you've already sent content, you can not "refresh" the page..
you can send some headers to change the location but just before sending any content..
Could that work...? I'm not exactly sure if that will work but it was just an idea that popped into my head when I read your post. I'm sorry if it doesn't work. If it does, I hope that helps.
First question: why do you need to refresh your page at the end of your script? (I can't think of a reason why you would, but that doesn't mean there isn't one.)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I have a form that deletes data from a table. The user chooses the item from the active page and presses the button. The item is deleted but they have to click a link to refresh the page.
Well, it seems if you did the form processing and database update and then generated your page output, there would be no reason to refresh -- but maybe I'm missing something?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
Just be aware that when you do a "==" or "!=" comparison or when using the empty() function; the values 0 (zero), "" (empty string) and the boolean FALSE constant are all treated as equivalent. Therefore, if zero or a boolean false is a valid entry, then you should use "===" or "!==" against an empty string when doing your comparison. Plus, I normally trim() the inputs first to get rid of leading/trailing spaces:
PHP Code:
foreach($_POST as $key => $val)
{
$_POST[$key] = trim($val);
}
if(isset($_POST['input']) and $_POST['input'] !== '')
{
// good to go
}
else
{
// missing a required entry
}
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I want to delete from a table of mysql database. My problem is that after i delete a second record, only if i press 'Ctrl+F5' that record disapear.Meanwhile, from the database that record is deleted. What should i do? I have to complete that i'm working on apache server, on localhost, there was no problem.
Thanks !
This is the code:
PHP Code:
<?php
ob_start();
include "conectarebd.php";
$idul=$_GET['id'];
mysql_query("DELETE FROM angajator WHERE id='$idul' ") or die(mysql_error());
Bookmarks