Menu
hi
is there a php function that I can add to my code to refresh the page after it comes to the end of my script.
thank you
[code=php]header("Location: http://your.domain.com/bla.php");[/code]
[code=php]<?php
# Your script here...
# Your script here...
# Your script here...
echo('<meta http-equiv="refresh" content="20">');
?>[/code]
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. ?[code=php]
<?
include 'db.php';
$active_id = $_SESSION['user_id'];
$buddy_id = $_POST['addbuddy'];
$array = explode(",",$buddy_id);
$post_b_id = $array[0];
$first_name = $array[1];
$last_name = $array[2];
$query = mysql_query("SELECT * FROM buddylink WHERE owner_id ='$active_id'") or die ("Search Error" .mysql_error());
$tbl .= "<form name='dBuddy' method='post' action='addbuddy.php'>";
$tbl .='<table width="200" border="1" cellspacing="2">';
$tbl .='<tr>';
$tbl .='<td>Delete</td>';
$tbl .='<td width="303">Name:</td></tr>';
while($r=mysql_fetch_assoc($query)) {
$f_name = $r['first_name'];
$l_name = $r['last_name'];
$b_id = $r['buddy_id'];
$tbl .= "<tr><td align=center><input type=radio name='deletebuddy' value='$b_id'></td>";
$tbl .="<td><a href='SearchDetails.php?owner_id=$b_id'>$f_name $l_name</a></td></tr>";
}
$tbl .="</table>";
$tbl .= "<input align=left type='submit' name='submit' value='Delete>";
$tbl .= "</form>";
if($buddy_id != ""){
// ADD TO TABLE
$sql = mysql_query("INSERT INTO buddylink (owner_id, buddy_id, first_name, last_name, added)VALUES('$active_id', '$post_b_id', '$first_name', '$last_name', now())")or die ("Link Create Error:" .mysql_error());
}
$d_buddy = $_POST['deletebuddy'];
if($d_buddy != ""){
mysql_query("DELETE FROM buddylink WHERE buddy_id = '$d_buddy'");
echo 'Buddy has been deleted';
}
echo $tbl;
?>
[/code]
[code=php]
<?
include 'db.php';
$active_id = $_SESSION['user_id'];
$buddy_id = $_POST['addbuddy'];
$array = explode(",",$buddy_id);
$post_b_id = $array[0];
$first_name = $array[1];
$last_name = $array[2];
if($buddy_id != ""){
// ADD TO TABLE
$sql = mysql_query("INSERT INTO buddylink (owner_id, buddy_id, first_name, last_name, added)VALUES('$active_id', '$post_b_id', '$first_name', '$last_name', now())")or die ("Link Create Error:" .mysql_error());
}
$d_buddy = $_POST['deletebuddy'];
if($d_buddy != ""){
mysql_query("DELETE FROM buddylink WHERE buddy_id = '$d_buddy'");
echo 'Buddy has been deleted';
}
$query = mysql_query("SELECT * FROM buddylink WHERE owner_id ='$active_id'") or die ("Search Error" .mysql_error());
$tbl .= "<form name='dBuddy' method='post' action='addbuddy.php'>";
$tbl .='<table width="200" border="1" cellspacing="2">';
$tbl .='<tr>';
$tbl .='<td>Delete</td>';
$tbl .='<td width="303">Name:</td></tr>';
while($r=mysql_fetch_assoc($query)) {
$f_name = $r['first_name'];
$l_name = $r['last_name'];
$b_id = $r['buddy_id'];
$tbl .= "<tr><td align=center><input type=radio name='deletebuddy' value='$b_id'></td>";
$tbl .="<td><a href='SearchDetails.php?owner_id=$b_id'>$f_name $l_name</a></td></tr>";
}
$tbl .="</table>";
$tbl .= "<input align=left type='submit' name='submit' value='Delete>";
$tbl .= "</form>";
echo $tbl;
?>
[/code]
[code=php]
if (isset($_POST['input']) && !empty($_POST['input'])) {
//add, delete or anything here..
} else {
//just output the table
}
[/code]
[code=php]
foreach($_POST as $key => $val)
{
$_POST[$key] = trim($val);
}
if(isset($_POST['input']) and $_POST['input'] !== '')
{
// good to go
}
else
{
// missing a required entry
}
[/code]
[code=php]header('Location: '.$_SERVER['PHP_SELF']);[/code]
[/QUOTE]
[code=php]<form name='myform' method='post' action='".$_SERVER['PHP_SELF']."?action=del'>[/code]
[code=php]if ($_GET['action'] == "del")
{
// get the hidden value
$n = $_POST['n'];
for ($i=0; $i<=$n-1; $i++)
{
if (isset($_POST['NPM'.$i]))
{
$NPM = $_POST['NPM'.$i];
$query = "DELETE FROM mahasiswa WHERE NPM = '$NPM'";
mysql_query($query);
}
}
}
[/code]
[code=php]<?php
ob_start();
include "conectarebd.php";
$idul=$_GET['id'];
mysql_query("DELETE FROM angajator WHERE id='$idul' ") or die(mysql_error());
header('location: http://domain.ro/edit_angajator_button.php'.$random);
?>[/code]
0.1.9 — BETA 6.2