Jump to content

Search the Community

Showing results for tags 'delete confirmation'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hi All, Would appreciate some pointers in how I can echo out the "name" field in my delete confirmation. I understand the process on echoing the $name variable after the message but haven't been able to figure out how to define the variable that holds the name field value upon deletion. Do I need to setup another mysql query to get the value from the name field in a assoc array? Any help or pointers for better understanding would be very much appreciated. Thanks! Code: <?php require("database.php"); $id = 0; if (!empty($_GET["id"])) { $id = $_REQUEST["id"]; } if (!empty($_POST)) { // Keep track of post values $id = $_POST["id"]; $name = $_POST["name"]; // Delete data $pdo = Database::connect(); $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $query = "DELETE FROM customers WHERE id = ?, name = ?"; $stmt = $pdo->prepare($query); $stmt->bindValue(1, $id, PDO::PARAM_INT); $stmt->bindValue(2, $name, PDO::PARAM_STR); $stmt->execute(); Database::disconnect(); header("Location: index.php"); } ?> HTML: <form class="form-horizontal" action="delete.php" method="post"> <input type="hidden" name="id" value="<?php echo $name; ?>" /> <p class="alert alert-error">Are you sure you want to delete?</p> <div class="form-actions"> <button type="submit" class="btn btn-danger">Yes</button> <a class="btn" href="index.php">No</a> </div> </form>
×
×
  • 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.