wow tnx sir xiao_xiao...should really research more about php functions
sir i have another problem...this is my table embedded trough php
delete on the last part are buttons...
heres the code
Code:
<?php
$con= mysql_connect("localhost","root");
if(!$con)
{
die("could not connect". mysql_error());
}
mysql_select_db("address",$con);
$result= mysql_query("select * from contacts");
echo "<center><table border= 1 >
<tr>
<th bgcolor=#0000FF><font size=1>UserId</th>
<th bgcolor=#0000FF><font size=1>Name</font></th>
<th bgcolor=#0000FF><font size=1>Tel. No.</font></th>
<th bgcolor=#0000FF><font size=1>Action.</font></th>
</tr>";
while($row=mysql_fetch_array($result))
{
$value= $row['userid'];
echo "<tr>";
echo "<td bgcolor=#0000FF > <font size=1><form method='post' action='del.php'> <input type='text' name='delthis' disabled='disabled' size='12' value=".$value."></td>";
echo "<td bgcolor=#0000FF > <font size=1>".$row['lname'].", ".$row['fname']."</td>";
;
echo "<td bgcolor=#0000FF> <font size=1>".$row['phone']."</font></td>";
echo "<td bgcolor=#0000FF> <font size=1><input type='submit' value='delete'></form></font></td>";
echo "</tr>";
}
echo "</table></center>";
mysql_close($con);
?>
but the problem is dili kuno recognize ang $_Post[delthis] na variable sa ako delete query...code for del.php goes like this
Code:
<?php
$con= mysql_connect("localhost","root");
if(!$con)
{
die("could not connect". mysql_error());
}
mysql_select_db("address",$con);
$sql2= "delete from contacts where userid='$_POST[delthis]'";
if(!mysql_query($sql2,$con))
{
die("Error".mysql_error());
}
mysql_close($con);
?>
unsa diay sayop ani sir? been trying to fix it all day...changing the position of the quotations, changing variable names but to no avail...the actual error is
Notice: Undefined index: delthis in C:\wamp\www\night\del.php on line 22
line 22 is the sql query