When I submit a form on my site and it goes to my database it updates successfully BUT! The problem is the old info that was in the database before i submitted a new update is still there.. The Echo is not updating... Strange and doesn't make sence!
Here is my entire page form!
<?php
session_start(); // Must start session first thing
// Here we run a login check
if (!isset($_SESSION['id'])) {
$msgToUser = 'Please <a href="http://www.sourcevibe.com">log in</a> to access your account';include_once 'msgToUser.php';
exit();
}
//Connect to the database through our include
include_once "connect_to_mysql.php";
// Place Session variable 'id' into local variable
$id = $_SESSION['id'];
// Process the form if it is submitted
if ($_POST['vibe']) {
$vibe = $_POST['vibe'];
$sql = mysql_query("UPDATE members SET vibe='$vibe' WHERE id='$id'");
$success = '<big style="font-weight: bold; font-style: italic;"><span style="color: #004A80;">Your account info has been updated</span></big>';include_once 'edit_info.php';
} // close if post
?>
<?php
session_start(); // Must start session first thing
// See if they are a logged in member by checking Session data
$toplinks = "";
if (isset($_SESSION['id'])) {
// Put stored session variables into local php variable
$userid = $_SESSION['id'];
$toplinks = '<a href="member_profile.php?id=' . $userid . '">Profile</a><span style="color: rgb(53, 162, 234);"> •</span>
<a href="http://www.sourcevibe.com">Account</a> <span style="color: rgb(53, 162, 234);">• </span>
<a href="logout.php">Log Out</a>';
} else {
echo 'Please <a href="http://www.sourcevibe.com">log in</a> to access your account';
exit();
}
?>
<?php
//Connect to the database through our include
include_once "connect_to_mysql.php";
// Query member data from the database and ready it for display
$sql = mysql_query("SELECT * FROM members WHERE id='$userid'");
while($row = mysql_fetch_array($sql)){
$vibe = $row["vibe"];
}
?>
<LINK REL="SHORTCUT ICON" HREF="http://www.sourcevibe.com/graphics/faveicon.gif">
<!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>
</td>
<LINK REL="SHORTCUT ICON" HREF="http://www.sourcevibe.com/graphics/faveicon.gif">
<title>Source Vibe</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" type="text/css" href="../default.css"><style>#bodydiv { height: 500px; }</style></head><body> <div id="container"> <div id="content">
<div id="navbar"> <br><br><br><br><?php include 'menu/menu.php'; ?>
</div> <div id="bodydiv">
<br><br>
<table
style="width: 950px; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="5">
<tbody>
<tr>
<td
style="vertical-align: top; width: 200px; text-align: right;"><a
href="http://www.sourcevibe.com/account/edit_info.php">Edit
"About Me"</a><br>
<br>
<a
href="http://www.sourcevibe.com/account/edit_info2.php">Edit
Social Links</a></td>
<td
style="text-align: center; vertical-align: top; width: 572px;">
</head>
<body>
<div align="center">
<h3><span style="color: rgb(0, 74, 128);">Edit your account info here</span><br />
</h3><?php print "$success"; ?>
</div>
<table align="left" cellpadding="8" cellspacing="8">
<form action="edit_info.php" method="post" enctype="multipart/form-data" name="form" id="form" onsubmit="return validate_form ( );">
<tr>
<td><div align="right">vibe URL:</div></td>
<td><div style="text-align: left;"><input name="vibe" type="text" id="vibe" value="<?php echo "$vibe"; ?>" size="40" maxlength="60" /></td>
</tr><tr>
</tr><tr>
<td> </td>
<td><input name="Submit" type="submit" value="Submit Changes" /></td>
</tr>
</form></table>
</td>
<td
style="text-align: center; vertical-align: top; width: 150px;"><script type="text/javascript"><!--
google_ad_client = "ca-pub-0568620827775779";
/* shorter skyscraper */
google_ad_slot = "6495899522";
google_ad_width = 120;
google_ad_height = 240;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></td>
</tr>
</tbody>
</table>
</div><div id="footer"></div><div id="underfooter"><p class="footer">
<img alt=""
src="http://harborcitysolutions.com/sourcevibe.com/graphics/layout/line.png"><br>
<a style="color: #35A2EA;" href="http://www.sourcevibe.com"><small>HOME</small></a>|<a style="color: #35A2EA;"
href="http://www.sourcevibe.com/account/member_search.php"> <small>MEMBER SEARCH</small></a>
| <a style="color: #35A2EA;" href="http://www.sourcevibe.com/aboutus.php"><small>ABOUT US</small></a>
| <a style="color: #35A2EA;" href="http://www.sourcevibe.com/contactus.php"><small>CONTACTUS</small></a><br>
<br>© 2013 Source Vibe. Project by <a style="color: #555; font-weight: normal !important;" href="http://www.harborcitysolutions.com"><small>Harbor City Solutions.</small></a> All Rights Reserved.
<br>
<a style="color: #CC0000;" href="http://www.sourcevibe.com/problemreport.php" target="_blank"><small><small>Report a Problem</small></a>
<table
style="width: 950px; text-align: left; margin-left: auto; margin-right: auto;"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="text-align: center; vertical-align: top;"><div style="position:relative; top: -640px; left:300px;"><?php echo $toplinks; ?></div></td>
</tr>
</tbody>
</table>
</p></div> </div></div></div></body></html>