ok what i am trying to do is pull data from a table and display it in an html table
in one of the fields will be a check box with their name in as the value $name
ive gotten everything to echo out but i do not know how to change it into the form to them submit to mysql statemnt to update a field
i dont know how to handle the post information as it could be many people or just 1
ive tried explode and implode the posted variable but i dont know what im doing
the last if statement is where i am trying to do the proccessing of the update form
<html>
<head>
<script Language="JavaScript">
function FormValidator(theForm)
{
if (theForm.username.value == "")
{
alert("Please enter a value for the \"user name\" field.");
theForm.username.focus();
return (false);
}
if (theForm.password.value == "")
{
alert("Please enter a value for the \"password\" field.");
theForm.password.focus();
return (false);
}
return (true);
}
</script>
</head>
<body>
<?php
$action = strtolower($_POST['action']);
$action = str_replace(';', '', $action);
$action = stripslashes($action);
$action = str_replace('%', '', $action);
if ($action == "send") {
$urn = strtolower($_POST['username']);
$urn = str_replace(';', '', $urn);
$urn = stripslashes($urn);
$urn = str_replace('%', '', $urn);
$urp = str_replace(';', '', $_POST['password']);
$urp = stripslashes($urp);
$urp = str_replace('%', '', $urp);
$whom = strtolower($_POST['whom']);
$whom = str_replace(';', '', $whom);
$whom = stripslashes($whom);
$whom = str_replace('%', '', $whom);
if (!$urn && !$urp && !$whom){
print "Please complete all fields before pressing submit!";
exit;
}
######connect
$dblink = mysql_pconnect('', '', '') or die('Could not connect to the database: ' .mysql_error());
mysql_select_db('') or die('Could not select database');
$datafromdb="SELECT * FROM account_data WHERE urn=\"$urn\"";
$thedata=mysql_query($datafromdb);
#####echo ("connected <br>");
#####grab id and password of person
if (mysql_num_rows($thedata) > 0) {
$getpassword = mysql_query("SELECT * FROM account_data WHERE urn=\"$urn\"");
$list = mysql_fetch_array($getpassword);
$selpassword = $list['urp'];
$selval = $list['val'];
$selclan = $list['clan'];
#####echo 'got ur pw <br>';
#####check password
if ($selpassword == "$urp") {
#####echo 'pw is good <br>';
if ($selval == "0") {
echo "Please activate your account via the link provided in the email";
exit;
}
if ($selclan == "0") {
include ("table.php");
}else{
$query="SELECT * FROM account_data where clan ='$selclan' ORDER BY `urn`";
$result=mysql_query($query);
$num=mysql_numrows($result);
$i=0;
$getclaninfo = mysql_query("SELECT * FROM clan_data WHERE id=\"$selclan\"");
$list = mysql_fetch_array($getclaninfo);
$clan_name = $list['clan_name'];
$clan_leader = $list['clan_leader'];
echo "<center><h1>" . $clan_name . "</center></h1>";
echo "<center><h2>Clan Leader: " . $clan_leader . "</center></h2>";
echo "<center><form action=\"admin.php\" method=\"POST\"><table border=2>\n";
echo "<input type=\"hidden\" name=\"delete\" value=\"true\"><tr><td><b>Name</b></td><td><b>Server</b></td><td><b>Delete</b></td></tr>\n";
while ($i < $num) {
$server=mysql_result($result,$i,"server");
$name=mysql_result($result,$i,"urn");
$race=mysql_result($result,$i,"race");
$bfid=mysql_result($result,$i,"bfid");
// changed line
echo "<tr><td><a href=\"http://s$userver.bitefight.org/bite/player.php?p=$bfid\" target=\"_blank\">$name</a> ($race)</td><td>$server</td><td><input type=\"checkbox\" name=\"rperson\" value=\"$name\"></td></tr>\n";
$i++;
}
// added line
echo "</table><br><br><input type=\"submit\" value=\"Submit\" name=\"submit\"></center>\n";
mysql_close();
}
}else{
echo "Invalid password, if you are having problems email i@gmail.com";
}
}else{
echo 'Invalid password, if you are having problems email i@gmail.com';
}
}else{
##### include form when not posting the data
$whom = strtolower($_GET['whom']);
$whom = str_replace(';', '', $whom);
$whom = stripslashes($whom);
$whom = str_replace('%', '', $whom);
include ("adminlogin.php");
}
####procces form for update in sql
if ($_POST['delete'] == "true") {
echo $_POST['rperson'];
}
?>
</body>
</html>
any help will be much appricated
thx