plz plz plz somebody help me :( :(
here is the code .. what i want is to link the emailid with a page named update.php...in which i can edit the particular emailid's row in databse ...or one can also tell to create a button EDIT .. but then i hav to use checkbox property..(of course 4 dat 2 i need the code :| )......... plz sombody help me :(
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
</head>
<body>
<?php
include("config.php");
$sql="SELECT * FROM contact";
$result=mysql_query($sql);
echo "<form method=post action=''>";
echo "<table border='0' cellspacing='5' cellpadding='0' width='600' align='center'>";
echo"<tr bgcolor='#ffffff'>";
echo"<td> </td>";
echo"<td align='center' bgcolor='#FFFFFF'><strong>emailid</strong></td>";
echo"<td align='center' bgcolor='#FFFFFF'><strong>forwarding</strong></td>";
echo"<td align='center' bgcolor='#FFFFFF'><strong>autoresponse</strong></td>";
echo"<td align='center' bgcolor='#FFFFFF'><strong>company</strong></td>";
echo"<td align='center' bgcolor='#FFFFFF'><strong>Password</strong></td>";
echo"<td align='center' bgcolor='#FFFFFF'> </td></tr>";
while($rows=mysql_fetch_array($result)){
echo"<tr bgcolor='#ffffff'>";
echo"<td>";
echo"<input type = 'checkbox' name='box[]' value=\"".$rows['emailid']."\"'</td>";
echo"<td bgcolor='#FFFFFF'>".$rows['emailid']."</td>";
echo"<td bgcolor='#FFFFFF'>".$rows['forwarding']."</td>";
echo"<td bgcolor='#FFFFFF'>".$rows['autoresponse']."</td>";
echo"<td bgcolor='#FFFFFF'>".$rows['company']."</td>";
echo"<td bgcolor='#FFFFFF'>".$rows['password']."</td>";
echo"<td bgcolor='#FFFFFF'> </td></tr>";
}
?>
<tr><td colspan =6 align=center><input type="submit" value="Delete" name="delete">
<input type="button" name="new" value="new" onClick="window.location.href='second.php'" />
</form></td></tr></table>
<?php
if(isset($_POST['delete'])){//check to see if the delete button has been pressed
if(isset($_POST['box'])){ //check to see if any boxes have been checked
$num = 0;//used to count the number of rows that were deleted
$box = $_POST['box'];
while (list ($key,$val) = @each ($box)) { //loop through all the checkboxes
$num++;
$sqldel="DELETE FROM contact WHERE emailid='$val'";//delete any that match id
$resdel=mysql_query($sqldel);//send the query to mysql
}
//print the logs that were deleted
echo"$num record(s) have been deleted.";
echo "<meta http-equiv=\"refresh\" content=\"0;URL=eg2.php\">";
//<META HTTP-EQUIV=Refresh CONTENT="3; URL=eg2.php">
}
else{ //no boxes checked
echo "No records selected.";
}
}
?>
</center>
</div>
</body>
</html>