Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.