2013-07-30 4 views
0

저는 지금 당분간 내 웹 사이트의 관리자 측에서 작업하고 있습니다.delete.php 페이지 DB 콘텐츠를 삭제하지 않습니다.

mysql의 mobi DB에 항목을 추가 할 페이지를 성공적으로 만들었습니다.

그러나 delete.php 페이지를 추가 할 때 매우 효과적이지 않습니다.

드롭 다운 메뉴에서 DB의 모든 기사를로드하고 나열하지만, ​​더 이상 필요하지 않은 항목을 선택하면 페이지의 코드로 색인화되지만 내 사이트는 삭제되지 않습니다. 기사. 내가 잘못 가고 어디 사람이

<?php 

session_start(); 

include_once('../include/connection.php'); 
include_once('../include/article.php'); 

$article = new storearticle; 

if (isset($_SESSION['logged_in'])) { 
    if (isset($_GET['title'])) { 
     $id = $_GET['title']; 
     $query = $pdo->prepare('DELETE FROM mobi WHERE promo_title = ?'); 
     $query->bindValue(1, $title); 
     $query->execute(); 

     header('Location: index.php'); 
    } 
    $articles = $article->fetch_all(); 
?>   
<html> 
    <head> 
     <title>Delete Article</title> 
     <link rel="stylesheet" href="../other.css" /> 
    </head> 

    <body> 
     <div class="container"> 
     <a href="index.php" id="logo"><b>&larr; Back</b></a> 

     <br /> 
     <div align="center"> 
      <h4>Select an article to delete:</h4>  
      <form action="delete.php" method="get"> 
       <select onchange="this.form.submit();" name="title"> 
       <?php foreach ($articles as $article){ ?> 
        <option value="<?php echo $article['promo_title']; ?>"><?php echo $article['promo_title']; ?></option> 
       <?php } ?> 
       </select> 
      </form>  
     </div> 
     </div> 
    </body> 
</html> 
<?php 
} else { 
    header('Location: index.php');  
} 
?> 

을 볼 수

내 DELETE.PHP 페이지는이 무엇입니까?

추가 정보가 필요하면 알려주십시오.

+0

당신은 print_r ($ articles); .. – user20232359723568423357842364

+0

안녕하세요 사용자 ... 나는 아래에 명시된 바와 같이 $ id를 $ title로 변경했습니다. 감사. – kevstarlive

답변

4

당신은

$id = $_GET['title']; 

에 의해 ID를 할당하고 다음이 $title하여 얻으려고 노력하고 있습니다. 나는 그것이 문제라고 생각한다.

관련 문제