Page 1 of 1
Database
Posted: Mon Mar 17, 2003 12:45 am
by pinkygal
hi,
i want to combine the edit or delete the user information after i have sucessfully gotten my search result. How do I go about doing it?
Posted: Mon Mar 17, 2003 2:51 am
by twigletmac
You need to give a lot more information that this. Do you have any code you are working on? What search result? What user information do you want to edit/delete? We need to know as much as possible in order to help you.
Mac
Posted: Mon Mar 17, 2003 2:57 am
by pinkygal
I am developing an address book that contains the user's first name, last name, email, contact, address and occupation. It includes a search function to search for the particular user. When i get the search result, there suppose to be two buttons(one for editing and the other for deleting) the user's information. However, I do not know how to go about doing it. And is it possible for the user to view his updated information after he has change his information and click on update? if yes, how can i acheive it? And is my code correct for the two submit buttons that I mentioned earlier?
<html>
<head>
<title>Search Result</title>
</head>
<body>
<?php
$Pattern=".+@+\..+";
if($fname="")||((is_numeric($fname))){
echo "Please enter a valid First Name!<a href="search.html">BACK</a>";
}elseif ($lname="")||((is_numeric($lname))){
echo "Please enter a valid Last Name!<a href="search.html">BACK</a>";
}elseif($address=""){
echo "Please enter your Address!<a href="search.html">BACK</a>";
}elseif(eregi($Pattern,$email)){
echo "Please enter a valid email!<a href="search.html">BACK</a>";
}elseif($occupation="")||(is_numeric($occupation)){
echo "Please enter a valid Occupation!<a href="search.html">BACK</a>";
}else{
$Host="localhost";
$User="0000985B";
$Password="0000985B";
$DBName="0000985B";
$TableName="AddressBook";
$Link=mysql_connect($Host,$User,$Password);
$Query="SELECT *
FROM $TableName
WHERE FirstName=$Array[FirstName],
LastName=$Array[LastName],
Address=$Array[Address],
Email=$Array[Email],
Occupation=$Array[Occupation]";
$Result=mysql_db_query($DBName,$Query,$Link);
print("<table border=1 width=\"75%\" cellspacing=2
cellpadding=2 align=center>\n");
print("<tr align=center valign=top>\n");
print("<td align=center valign=top>Name</td>\n");
print("<td align=center valign=top>Contact</td>\n");
print("<td align=center valign=top>Address</td>\n");
print("<td align=center valign=top>Email</td>\n");
print("<td align=center valign=top>Occupation</td>\n");
print("</tr>\n");
while($Row=mysql_fetch_array($Result)){
print("<tr align=center valign=top>\n");
print("<td align=center valign=top>$Row[FirstName]
$Row[LastName]</td>\n");
print("<td align=center valign=top>$Row[Contact]</td>\n");
print("<td align=center valign=top>$Row[Address]</td>\n");
print("<td align=center valign=top>$Row[Email]</td>\n");
print("<td align=center valign=top>$Row[Occupation]</td>\n");
print("</tr>\n");
}
print("<form action=delete.php method=post>\n");
print("<input type=submit name=submit value=submit>");
print("</form>");
print("<form action=edit.php method=post>\n");
print("<input type=button name=edit value=edit>");
print("</form>");
mysql_close($Link);
print("</table>\n");
?>
</body>
</html>