Entry
How do I achieve the effect of presenting a Please wait page, while waiting for a large database table to be loaded up?
Apr 4th, 2000 09:28
Allan Taylor, Joe Cheong,
I acheived this using the following code. Hopefully it is self
explanatory
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function doSubmit($var1)
{
location.href = "filename.phtml?var2=$var1";
}
//-->
</script>
</head>
<body
<?
IF (ISSET($ITEM)) /* If there has NOT been given a value for selected
product */
{ // begin IF ISSET
echo "<center><table BORDER=2 CELLSPACING=3 CELLPADDING=3
WIDTH='98%' BGCOLOR='black'>"
."<tr ALIGN=CENTER><td><font color=yellow
size=+4><blink>Searching
Database</blink></font></td></tr></table></center>";
echo "<SCRIPT LANGUAGE=\"JavaScript\">";
{
echo "doSubmit($var1)";// calls javascript function to load new
page
}
echo "</script>";
} // end ISSET set
else
{ // begin if NOT ISSET
?>
<center><table BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="98%" >
<tr ALIGN=CENTER>
<td ALIGN=CENTER><form action="<? ECHO $PHP_SELF ?>" method=POST>
<table BORDER=2 >
<tr>
<th><font size=+1>Product:</font></th>
<td><select NAME=ITEM SIZE="10"><option SELECTED VALUE="">------Items
For Sale -------
<?
$Dbname = "nameofyourdatabase"; // name of data base
$Tbname_3 = "tablename1"; // name of table1
$Tbname_4 = "tablename2"; // name of table2
$Tbname_5 = "tablename..."; // name of table ditto
msql_connect(); // connects to the msql-server on Localhost
$variablename = MSQL($Dbname,"SELECT * FROM $Tbname_3");
WHILE($row = msql_fetch_row($variablename)) // loop until all products
in table for selecting
{ //begin WHILE loop1
echo "<option>".($row[0])." ".($row[2])." ".($row[3])."\n";
/* finds fields item_num, category and description*/
} // end WHILE loop1
msql_free_result($products);
/* To release the memory occupied by the product */
?></select></td></tr>
<tr><td><BR></td>
<TD><input type="submit" value="SUBMIT">
</TD></tr></table>
</td></tr></table></center>
</form>
<?
echo "<center><h3><font color=\"red\">PLEASE select an
Item</font></h3></center>";
} // end if NOT ISSET
?>
</body>
</html>