PHP/HTML Add A remove button

前端 未结 2 1012
一整个雨季
一整个雨季 2021-01-26 02:32

I have the code below to retrieve rows from a database where the username column matches the base directory name:

$username =  basename(dirname(__FILE__));
$user         


        
2条回答
  •  [愿得一人]
    2021-01-26 02:50

    You could just add a submit button linking to the same page like

    while ($row = mysql_fetch_array($result)) { //loop
      extract($row);
      $html .= "
  • {$link}
    - {$notes}
  • "; }

    Then in your page do something like

    if (!empty($_POST["delete"])){
         $query = "DELETE FROM links where link = '{$_POST["Delete"]}'";
         mysql_query($query);
    }
    

    That's the basic idea of how I would do it

提交回复
热议问题