Forum Moderators: coopster
the problem comes when i need to edit the user's tables... anything typed by the current user replaces EVERYONE's fields as well as the intended location.
here's the code:
<html>
<head>
<title>Update</title>
</head>
<body bgcolor="white">
<?php
foreach($HTTP_POST_VARS as $varname => $value)
$formVars[$varname]=$value;
require_once("includes/_connect.php");echo "Record updated";
$query="UPDATE staff set ".
"top1= \"".$formVars["top1"]."\",".
"top2= \"".$formVars["top2"].
"\" WHERE name = \"".$formVars["name"]."\"";
mysql_query($query);
mysql_close($connection);
?>
<?php echo $formVars["name"];?>
</body>
</html>
can anyone see what could be causing the problem here?
here is my _connect.php:
<?php
$host = "localhost";
$user = "myusername";
$pass = "mypassword";
$dbname = "mydatabase";$connection = mysql_connect($host,$user,$pass) or die (mysql_errno().": ".mysql_error()."<BR>");
mysql_select_db($dbname);
?>
i'm new to php, so i'm going one step at a time.