0

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.

Edited by super-duper: n/a

2
Contributors
1
Reply
9
Views
5 Years
Discussion Span
Last Post by vaultdweller123
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.