I'm trying to create a delete button that lets a user "delete" an entry from mysql database.
I have a demo.php page, where my php connects to my database and inserts data into it.
And I have a demo-form.php which is to display the form and when "submit" button is clicked calls the demo.php.

//demo.php page

<?php
 
 $fname=$_POST['fname']; 
 $lname=$_POST['lname']; 
 $address=$_POST['address'];
 $city=$_POST['city'];
 $state=$_POST['state'];
 $zip=$_POST['zipcode'];
 
 mysql_connect("localhost", "username", "password") or die(mysql_error()); 
 mysql_select_db("demo") or die(mysql_error()); 
 mysql_query("INSERT INTO `demoform` VALUES ('$fname', '$lname', '$address', '$city', '$state', '$zip')"); 
 Print "Your information has been successfully added to the database."; 
 
 ?>

//demo-form page

<html>
<body>
<form action="demo.php" method="post">
<p>
First Name: <input type="text" name="fname" /></br>
Last Name: <input type="text" name="lname" /></br>
Address: <input type="text" name="address" /></br>
City: <input type="text" name="city" /></br>
State: <input type="text" name="state" /></br>
Zip/Postal Code: <input type="text" name="zipcode" /></br>
<input type="submit" value="Submit" />
<input type="submit" value="Delete" />//this one i just typed in. doesn't work yet.
</p>
</form>
</body>
</html>

Am I on a right track? My "Submit" works. It is adding data to table.
But I'm kinda stuck with my "Delete" one.

1st you got to create a list view for person, you can list them up using <ul> then have them assign checkboxes each, then assign some id on every checkbox so you can specify which record to delete

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.