Hi guys.
I appreciate all your response and wish every one joy and serenity of mind.
I've being trying to add data using the below php code but it seems it connect but dont add datas. and whenever I added the data directly in mysql it preview it on the view page.please help in checking the code.
add.php
<html>
<head><title>Sample Addint data</title></head>
<body bgcolor="#00FF00"><center>
<form action="view.php" method="POST">
<table width="450" border="1" cellpadding="2">
<tr>
<td>Name:</td>
<td><input type="text" name="name"></td>
</tr>
<tr>
<td>passwords:</td>
<td><input type="text" name="password" ></td>
</tr>
<?php
//connect...
$dbh = mysql_connect("localhost", "root", "");
//select database
if (mysql_select_db("sample", $dbh))
print"connected";
//add user
mysql_query("INSERT INTO users VALUES (\"".$POST"name"]."\",
\"".$POST["password"]."\")", $dbh);
//close connect
mysql_close($dbh);
//redirect the page...
?>
</table>
<br><br>
<input type="submit" value="Add user">
</form>
</center>
</body>
</html>
THIS PAGE PREVIEW ALL THE RECORD
view.php
<html>
<head><title>View all</title></head>
<body bgcolor="#000099">
<center>
<br><b>Registered Users </b><br><br>
<a href="add.php"> Add User</a>
<br><br>
<table width="450" border="1" cellpadding="2">
<tr bgcolor="#BBBBBB">
<td width="25%"><b>Name</b></td>
<td width="25%"><b>Password</b></td>
</tr>
<?php
// Connection...
$dbh = mysql_connect("localhost", "root", "");
//select the database
mysql_select_db("sample", $dbh);
//fetch all the users
$results = mysql_query("SELECT *FROM sample ORDER BY name", $dbh);
while($row = mysql_fetch_array($results))
{
print "<tr>";
print "<td>".htmlspecialchars($row["name"])."</td>";
print "<td>".htmlspecialchars($row["password"])."</td>";
print "</tr>";
}
mysql_close($dbh);
?>
</table>
</center>
</body>
</html>
please guys dont forget am still a starter incase their is any miscoding help in conrrecting it.\
Thanks
Hakeem.