Dear PHP people,
I am wondering if this is even close to working or should I scrap
it and start again.
Another Newbie
Here is the Form info:
html>
<H2><center>Update Page</center></H2>
<body>
<STYLE>
</style>
<body bgcolor="000000" text="#aabbcc">
<form action="updatedb.php" method="post" name="cust_fname"><br>
<strong>First Name: </strong><input type="Text" name="cust_fname"><br>
<strong>Last Name : </strong><input type="Text" name="cust_lname"><br>
<strong>Cust Addr1: </strong><input type="Text" name="cust_addr1"><br>
<strong>Cust Addr2: </strong><input type="Text" name="cust_addr2"><br>
<strong>Cust State: </strong><input type="Text" name="cust_st"><br>
<br></br>
<input type="radio" name="addrec" value="add" checked><b>Add Customer</b><br>
<input type="radio" name="delrec" value="delete"><b>Delete Customer</b><br>
<input type="radio" name="chgrec" value="change"><b>Change Customer</b><br>
<input type="Submit" value="submit" align="MIDDLE">
</form>
</body>
</html>
And here is the PHP code
<HTML>
<body>
<?php
//if(isset($submit=$add)) {
$db = mysql_connect("localhost", "root","");
mysql_select_db("test",$db);
if(isset($addrec)) {
$sql = "INSERT INTO customer (cust_fname,cust_lname, cust_addr1, cust_addr2, cust_st) VALUES
('$cust_fname', '$cust_lname', '$cust_addr1','$cust_addr2','$cust_st')";
$result = mysql_query($sql) or die(mysql_error());
echo "Thank you! Information entered.\n";
}
elseif(isset($delrec)) {
$sql = "DELETE FROM customer where 'cust_lname'='$cust_lname' and 'cust_fname'='$cust_fname'";
$result2 = mysql_query($sql) or die(mysql_error());
echo "Thank you! Customer Deleted.\n";
}
else {
PRINT ("You did not choose an option");
}
?>
</body>
</HTML>
Thanks for any advice.