Jump to content

[SOLVED] delete account form


quickstopman

Recommended Posts

im trying to make a delete account script

but nothing happens when you click the buttons

i know its probly something simple

but i need help

<?
include("config.php");
session_start();
ob_start();

$username = $_SESSION['username'];

if (isset($_SESSION['username'])) {
include("header.php");

$choice = $_POST['choice'];
$yes = $_POST['yes'];
$no = $_POST['no'];

if ($choice) {

if ($yes = "Yes") {
mysql_query("DELETE FROM users WHERE id='{$_SESSION['id']}'") or die(mysql_error());
header("Refresh:2; url=logout.php");
echo " Your account has been Deleted";
} else if ($no = "No") {
header("Location: editprofile.php");
}
} else {
echo "<h1> Are you sure??? </h1><br><br>";
echo "That you want to Delete ";
echo $username ;
echo "?";
echo '<form name="choice" method="POST" action="deleteaccount.php">
<input type="submit" value="Yes" name="yes">  <input type="submit" value="No" name="no">
</form>';
}
} else {
header("Location: default.html");
}
?>

thanks guys!

Link to comment
https://forums.phpfreaks.com/topic/52414-solved-delete-account-form/
Share on other sites

Just a quick thing I noticed. Towards the bottom where you say:

 

echo "That you want to Delete ";
echo $username ;
echo "?";

 

It's unneccesary to use that many echo statements. Just use concentation. (I think is the word) :

 

echo "That you want to Delete " . $username . "?";

 

Just for the sake of time and fingers!

 

yay for noob post  ;D

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.