Location: PHPKode > scripts > eNetman > enetman-20050830/enetman/html/add.php
<?

error_reporting(0);
foreach ($_POST as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_GET as $varname => $varvalue) {
        $$varname = $varvalue;
}
foreach ($_SERVER as $varname => $varvalue) {
        $$varname = $varvalue;
}
if($debug) {
        error_reporting(1);
        error_reporting(E_ALL);
}
echo "<form name='addmain' method='post' action='index.php?page=add.php&view=$view&nonav=1'>\n";
echo "<input type='hidden' name='action' value='add,main'>\n";
echo "<TABLE width='80%' cellspacing=0 border=0 cellpadding=0 align='center'>";
echo "<tr>";
echo "<td width='50%'>";

$query = "SELECT * FROM maindata";

$result = mysql_query($query);

echo "<table bgcolor='000000' cellpadding=0 border=0 cellspacing=0 align='center' width='100%'>\n";
echo "\t<tr>\n";
echo "\t\t<td>\n";
echo "\t\t\t<table cellpadding=0 border=0 cellspacing=1 width='100%'>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=2 align='center' bgcolor='#D3DCE3'><h3><b>Profile</b></td>\n";
echo "\t\t\t\t</tr>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=2 align='center' bgcolor='#CCCCCC'><img src='' width=1 height=1></td>\n"; 
echo "\t\t\t\t</tr>\n";

$num = mysql_num_fields($result);
$rnum = 0;
while($rnum != $num) {
        $colValue = mysql_field_name($result, $rnum);
	if($colValue == "Status") {
        	echo "\t\t\t\t<tr>\n";
                echo "\t\t\t\t\t<td bgcolor='#FFFFFF' width='50%'>&nbsp;&nbsp;<b>$colValue</b></td><td bgcolor='#FFFFFF'>&nbsp;&nbsp;<select name='$colValue'>\n<option value='Active' selected";
		echo ">Active</option>\n";
		echo "<option value='Inactive'";
		echo ">Inactive</option>\n";
                echo "\t\t\t\t</tr>\n";
	} elseif(($colValue != "ID") && ($colValue != "dataType")) {
		echo "\t\t\t\t<tr>\n";
                echo "\t\t\t\t\t<td bgcolor='#FFFFFF'>&nbsp;&nbsp;<b>$colValue</b></td><td bgcolor='#FFFFFF'>&nbsp;&nbsp;<input class='frmStyle' type='text' name='$colValue'>\n";
                echo "\t\t\t\t</tr>\n";
	}
	$rnum++;
}
echo "</table></td></tr></table>";
echo "<br>";


echo "<TABLE width='100%' cellspacing=0 border=0 cellpadding=0 align='center'>";
echo "<tr>";
echo "<td width='50%'>";

$query = "SELECT contacts.Name AS 'Contact', phone.Number, Extention FROM phone,contacts";
$result = mysql_query($query);

echo "<table bgcolor='000000' cellpadding=0 border=0 cellspacing=0 align='center' width='100%'>\n";
echo "\t<tr>\n";
echo "\t\t<td>\n";
echo "\t\t\t<table cellpadding=0 border=0 cellspacing=1 width='100%'>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=2 align='center' bgcolor='#D3DCE3'><h3><b>Phone Number</b></td>\n";
echo "\t\t\t\t</tr>\n";

echo "\t\t\t\t<tr>\n";
echo "\t\t\t\t\t<td colspan=2 align='center' bgcolor='#CCCCCC'><img src='' width=1 height=1></td>\n"; 
echo "\t\t\t\t</tr>\n";

$num = mysql_num_fields($result);
$rnum = 0;
while($rnum != $num) {
        $colValue = mysql_field_name($result, $rnum);
	if(($colValue != "ID") && ($colValue != "linkID") && ($colValue != "Main")){
		echo "\t\t\t\t\t<tr><td bgcolor='#FFFFFF' width='50%'>&nbsp;&nbsp;<b>$colValue</b></td><td bgcolor='#FFFFFF'>&nbsp;&nbsp;<input class='frmStyle' type='text' name='$colValue'></td></tr>\n";
	}
	$rnum++;
}
echo "</table></td></tr></table>";

echo "<tr><td bgcolor='#ffffff'><img src='' height='20' width='1'></td></tr>";
echo "<tr><td bgcolor='#ffffff' align='center'><input class='frmStyle' type='button' value='Add ".ucfirst($view)."' onClick='addmain.submit();'></td></tr>";

echo "</table>";

echo "</form>";

?>
Return current item: eNetman