1.11M Members

Late echo results

 
0
 

Hi everyone,

im just new in php and mysql. I have a form where i add list of member details then submit it to my db and redirect it back to the same page and echo the the list of data at the bottom. but the problem is after redirect the data doesn't show's up. I have to wait for a few minutes then refresh the page to be able to see the updated list at the bottom.

i really don't know what is the caused of this. because before it was working properly.

I would really appreciate your help in advance.

Thanks

 
0
 

It could be that your browser if caching your page. If you do a hard refresh (CTRL+F5 or CTRL+R), is it still a problem ?

Apart from that it could be a number of things, but hard to guess without seeing some code.

 
0
 

It could be that your browser if caching your page. If you do a hard refresh (CTRL+F5 or CTRL+R), is it still a problem ?

Apart from that it could be a number of things, but hard to guess without seeing some code.

after i submit there is no output so i do hard refresh (CTRL+F5 or CTRL+R) then the data appear. then i try again to submit new data... it seems that i always have to do hard refresh to see my new added data

here is my code

<?php
session_start();
if (!isset($_SESSION['user'])){
    header("location:../efeedback/login2.php"); 
    
}
?>
<?php


require_once "connect_to_mysql.php"; 
$admin_id = null;

if (!isset($_SESSION['user'])) {
    die('User id is not in session, blame the programmer');
}


$admin_id = $_SESSION['admin_id'];

$sqlCommand = "SELECT * FROM client_users";

$query = mysql_query($sqlCommand) or die (mysql_error()); 

if (!$query) {
    die(mysql_error());
}



?>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LIFO® E-Feedback Admin</title>
<link rel="shortcut icon" href="http://www.acghumancapital.com/sdt/favicon.gif" type="image/x-icon" /> 
<style type="text/css">
<!--

body {
	font: 100% Verdana, Arial, Helvetica, sans-serif;
	margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
	padding: 0;
	text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
	color: #F0F0F0;
	background-color: #FFFFFF;
}
.top {
	height: 150px;
	width: 800px;
	margin-right: auto;
	margin-left: auto;
}
.menu {
	height: 25px;
	width: 800px;
	margin-right: auto;
	margin-left: auto;
	background-color: #FFFFFF;
}
.content {
	height: auto;
	width: auto;
	margin-right: auto;
	margin-left: auto;
	color: #000000;
	background-position: center;
	background-color: #96F550;
}
.content1 {
	background-color: #96F550;
	height: auto;
	width: 800px;
	margin-right: auto;
	margin-left: auto;
}
.content2 {
	height: auto;
	width: 800px;
	margin-right: auto;
	margin-left: auto;
	color: #666666;
}
.footer {
	height: 200px;
	width: auto;
	margin-right: auto;
	margin-left: auto;
}
.style14 {font-size: 10px}
.style16 {
	font-size: 14px;
	color: #FFFFFF;
	font-weight: bold;
	font-family: Arial, Helvetica, sans-serif;
}
.style19 {color: #FFFFFF; font-size: 10px; }
.style21 {font-size: 10px; color: #666666; }
.style22 {
	color: #333333;
	font-size: 10px;
}
-->
</style>
<script type="text/javascript">
<!--
function validateForm()
{
var name=document.forms["form1"]["name"].value
if (name==null || name=="")
  {
  alert("You have not entered your client name");
  return false;
  }
var company=document.forms["form1"]["company"].value
if (company==null || company=="")
  {
  alert("You have not entered your client company name");
  return false;
  }
var email=document.forms["form1"]["email"].value
if (email==null || email=="")
  {
  alert("Please enter your client email");
  return false;
  }
var client_user=document.forms["form1"]["client_user"].value
if (client_user==null || client_user=="")
  {
  alert("Please enter a designated client user");
  return false;
  }
var client_pass=document.forms["form1"]["client_pass"].value
if (client_pass==null || client_pass=="")
  {
  alert("Please enter a designated client password");
  return false;
  }
var initials=document.forms["form1"]["initials"].value
if (initials==null || initials=="")
  {
  alert("Please enter user initials");
  return false;
  }
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
    } if (errors) alert('The following error(s) occurred:\n'+errors);
    document.MM_returnValue = (errors == '');
} }
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>

<body onload="MM_preloadImages('images/images/menu2_03.gif')">
<div class="top">
  <table width="800">
    <tr>
      <th width="261" height="85" scope="col">&nbsp;</th>
      <th width="261" scope="col">&nbsp;</th>
      <th width="262" scope="col">&nbsp;</th>
    </tr>
    <tr>
      <td><span class="content1"><img src="images/logo_template.PNG" width="307" height="52" /></span></td>
      <td>&nbsp;</td>
      <td><div align="right" class="style22"><a href="admin_logout.php">Logout</a></div></td>
    </tr>
  </table>
</div>

<div class="menu">
  <div align="left"><img src="images/images/menu_02.gif" width="81" height="25" /><a href="tracker.php"><img src="images/images/menu_03.gif" name="Image1" width="125" height="25" id="Image1" onmouseover="MM_swapImage('Image1','','images/images/menu2_03.gif',1)" onmouseout="MM_swapImgRestore()" /></a></div>
</div>
<div class="content">
  <div class="content1">
    <table width="800">
      <tr>
        <th width="12" scope="col">&nbsp;</th>
        <td width="327" scope="col"><div align="left" class="style16"></div></td>
        <th width="421" scope="col">&nbsp;</th>
        <th width="16" scope="col">&nbsp;</th>
      </tr>
      <tr>
        <td height="163">&nbsp;</td>
        <td valign="top"><div align="left">
          <form id="form1" name="form1" method="post" action="insert_client.php" onsubmit="return validateForm()">
            <table width="317">
              <tr>
                <td width="114" scope="col"><div align="left"><span class="style14">Name</span></div></td>
                <td width="191" scope="col"><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="name" id="name" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left"><span class="style14">Company Name</span></div></td>
                <td><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="company" id="company" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left"><span class="style14">Email</span></div></td>
                <td><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="email" id="email" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left"><span class="style14">Username</span></div></td>
                <td><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="client_user" id="client_user" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left"><span class="style14">Password</span></div></td>
                <td><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="client_pass" id="client_pass" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left"><span class="style14">Initials</span></div></td>
                <td><div align="left"><span class="style14"></span>
                  <label>
                  <input type="text" name="initials" id="initials" />
                  </label>
                </div></td>
                </tr>
              <tr>
                <td><div align="left">
                  <input type="reset" name="clear" id="clear" value="clear" />
                </div></td>
                <td><div align="left">
                  <input type="submit" name="add" id="add" value="add" />
                  <input name="admin_id" type="hidden" id="admin_id" value="<? echo $admin_id; ?>" />
                </div></td>
              </tr>
            </table>
            </form>
          </div>        </td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>

      <tr>
        <td colspan="4">&nbsp;</td>
      </tr>
    </table>
  </div>
</div>

<div class="content2">
  <table width="800">
    <tr>
      <th height="14" colspan="9" scope="col"></th>
    </tr>
    <tr>
      <td width="22" bgcolor="#666666"><div align="center" class="style19">ID</div></td>
      <td width="102" bgcolor="#666666"><div align="center" class="style19">NAME</div></td>
      <td width="131" bgcolor="#666666"><div align="center" class="style19">COMPANY NAME</div></td>
      <td width="159" bgcolor="#666666"><div align="center" class="style19">EMAIL</div></td>
      <td width="83" bgcolor="#666666"><div align="center" class="style19">USERNAME</div></td>
      <td width="77" bgcolor="#666666"><div align="center" class="style19">PASSWORD</div></td>
      <td width="93" bgcolor="#666666"><div align="center" class="style19">INITIALS</div></td>
      <td width="45" bgcolor="#666666"><div align="center"><span class="style19">EDIT</span></div></td>
      <td width="48" bgcolor="#666666"><div align="center"><span class="style19">DELETE</span></div></td>
    </tr>
    <?php while($row = mysql_fetch_array($query)){ ?>
    <tr>
      <td><div align="center"><span class="style21"><?php echo $row['client_id']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['name']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['company']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['email']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['client_user']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['client_pass']; ?></span></div></td>
      <td><div align="left"><span class="style21"><?php echo $row['initials']; ?></span></div></td>
      <td><div align="center"><span class="style21"><a href="edit.php?id=<? echo $row['id']; ?>">edit</a></span></div></td>
      <td><div align="center"><span class="style21"><a href="delete.php?id=<? echo $row['id']; ?>">delete</a></span></div></td>
    </tr>
    <?php } ?>
    <?php mysql_close($con) ?>
    <tr>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</div>
<div class="footer"></div>

</body>
</html>

and for the insert_client.php

<?php

session_start();
if (!isset($_SESSION['user'])){
    header("location:../efeedback/login2.php"); 
    
}

require_once "connect_to_mysql.php"; 

$admin_id = $_POST['admin_id'];
$name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
$client_user = $_POST['client_user'];
$client_pass = $_POST['client_pass'];
$initials = $_POST['initials'];



$sqlCommand = "INSERT INTO client_users (admin_id, name, company, email, client_user, client_pass, initials) 
VALUES('$admin_id','$name','$company','$email','$client_user','$client_pass','$initials')"; 
$query = mysql_query($sqlCommand) or die (mysql_error());



mysql_close($con); 
	header("location:add_client.php");


?>
You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: