Below is a document tree of the folders on my website. In my html form the action attribute holds this value: delete\_post.php. When I changed the action to /do/delete\_post/index.php it wouldn't work. How could I change this: do/delete\_post/index.php or something else to make it work?
![](https://i.stack.imgur.com/M4tgX.png "Document tree of documents on my website")

The index.php file is shown below:

```
<?php
session_start();
if (!isset($_SESSION['user']) || empty($_POST['id'])) 
  {
  header( "Location: /" );
  die();
  }
require_once( dirname(__FILE__) . '/includes/db.php')
$stmt2 = $db->prepare('DELETE FROM posts WHERE id = ?');
if (!$stmt2->execute(array($_POST['id'])))
  {
  print_r($stmt2->errorInfo());
  die();
  }
header( "Location: /" );

?>

```

When I make an ajax request using jquery in php with the following page the index.php fails to delete the post.