Hi,
I appreciated if some one there can help me out, i want to add new table ‘config’ but seem not work fine.
<?php
/********************** config.PHP**************************/
include 'dbc.php';
page_protect();
$err = array();
$msg = array();
if($_POST['doSave'] == 'Save')
{
// Filter POST data for harmful code (sanitize)
foreach($_POST as $key => $value) {
$data[$key] = filter($value);
}
if(empty($err)) {
mysql_query("UPDATE config SET
`SITE_TITLE` = '$data[SITE_TITLE]',
`SITE_KEYWORDS` = '$data[SITE_KEYWORDS]',
`SITE_DESCRIPTIONS` = '$data[SITE_DESCRIPTIONS]',
`SITE_MENUS` = '$data[SITE_MENUS]',
`SITE_COPYRIGHT` = '$data[SITE_COPYRIGHT]',
`SITE_METATAGS` = '$data[SITE_METATAGS]'
WHERE ID='$data[ID]") or die(mysql_error());
$msg[] = "Profile Sucessfully saved";
}
}
//$rs_edits = mysql_query("select * from users where ID='$_SESSION[user_id]'");
$rs_edits = mysql_query("select * from users where ID='$data[ID]'") or die(mysql_error());
?>
<html>
<head>
<title>Profile Edit</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="14%" valign="top">
<?php
/********************* MYACCOUNT MENU *******************/
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
<p><strong>My Account</strong></p>
<a href="index.php">Home</a><br><br>
<a href="profile_edit.php">Edit Profile</a><br><br>
<a href="pwd_change.php">Change Password</a><br><br>
<a href="logout.php">Logout </a><br><br>
</div>
<?php }
/*****************************END************************/
if (checkAdmin()) {
/**********************ADMIN MENU************************/
?>
<div class="myaccount"><br>
<a href="admin_cp.php">Admin CP </a><br /><br>
<a href="member_create.php">Add new Member</a><br><br>
<a href="config.php">Site Configuration</a><br><br>
</div>
<?php }
/*****************************END************************/
?>
</td>
<td width="74%" valign="top" style="padding: 10px;">
<h2 class="titlehdr">Your Profile Edit Form</font></h2>
<p>
<?php
if(!empty($err)) {
echo "<div class=\\"msg\\">";
foreach ($err as $e) {
echo "* $e <br>";
}
echo "</div>";
}
if(!empty($msg)) {
echo "<div class=\\"msg\\">" . $msg[0] . "</div>";
}
?>
</p>
<p>Hdff sdgsdgs g.</p>
<?php while ($row_edits = mysql_fetch_array($rs_edits)) {?>
<form name="myform" id="myform" method="post" action="">
<table width="80%" border="0" cellpadding="5" cellspacing="2" class="myaccount">
<tr>
<td>Site Title</td>
<td><input name="SITE_TITLE" type="text" id="SITE_TITLE" value="<?php echo $row_edits['SITE_TITLE']; ?>"></td>
</tr>
<tr>
<td>Site Slogan</td>
<td><textarea name="SITE_SLOGAN" cols="30" rows="1" id="SITE_SLOGAN"><?php echo $row_edits['SITE_SLOGAN']; ?></textarea></td>
</tr>
<tr>
<td>Site Keywords</td>
<td><textarea name="SITE_KEYWORDS" cols="30" rows="1" id="SITE_KEYWORDS"><?php echo $row_edits['SITE_KEYWORDS']; ?></textarea>
</td>
</tr>
<tr>
<td>Site Descriptions</td>
<td><textarea name="SITE_DESCRIPTIONS" cols="30" rows="1" id="SITE_DESCRIPTIONS"><?php echo $row_edits['SITE_DESCRIPTIONS']; ?></textarea></td>
</tr>
<tr>
<td>Site Menus</td>
<td><textarea name="SITE_MENUS" cols="30" rows="1" id="SITE_MENUS"><?php echo $row_edits['SITE_MENUS']; ?></textarea></td>
</tr>
<tr>
<td>Site Meta Tags</td>
<td><textarea name="SITE_METATAGS" cols="30" rows="1" id="SITE_METATAGS"><?php echo $row_edits['SITE_METATAGS']; ?></textarea></td>
</tr>
<tr>
<td>Site Copyright</td>
<td><textarea name="SITE_COPYRIGHT" cols="30" rows="1" id="SITE_COPYRIGHTS"><?php echo $row_edits['SITE_COPYRIGHT']; ?></textarea></td>
</tr>
</table>
<p>
<input name="doSave" type="submit" id="doSave" value="Save">
</p>
</form>
<?php } ?>
<td width="196" valign="top"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table>
</body>
</html>
and i got blank page, when i disabled
<?php while ($row_edits = mysql_fetch_array($rs_edits)) {?>
the form appears but can’t work fine.
That is seem cause to use GET parameter or SESSION. it just wont work with data[id]
any idea ? thanks in advance