2014-10-05 3 views
0

그래서 내 사이트 내의 특정 웹 페이지에 액세스하려고합니다. 내 인덱스에서"Index.php? webpage"제대로 작동하지 않습니다.

, 나는 다른 페이지에 액세스 할 수는 isset ($ _ GET() 매개 변수를 사용하여 다음과 같이 index.php에 대한 나의 코드는 다음과 같습니다.

<!DOCTYPE html> 
<html> 
<head> 
    <?php require ("includes/database.php"); ?> 
    <title>Offstreams Admin Panel</title> 
    <link rel="stylesheet" type="text/css" href="styles/admin_body.css" /> 
    <link rel="stylesheet" type="text/css" href="styles/admin_header.css" /> 
    <link rel="stylesheet" type="text/css" href="styles/admin_footer.css" /> 
    <link rel="stylesheet" type="text/css" href="styles/admin_postspace.css" /> 
</head> 
<body> 
    <header> 
     <!--Header Info Here --> 
    </header> 
    <div class="wrapper"> 
     <div class="sidebar"> 
      <ul> 
       <li><a href="index.php?post_new_band">Post New Band</a></li> 
      </ul> 
     </div> 
     <article> 
      <?php 
       if (isset($_GET['post_new_band'])){ 
        require ("includes/post_new_band.php"); 

        echo "Page accessed"; 
       } else { 
        echo "Page not accessible."; 
       }  
      ?> 
     </article> 
    </div> 
</body> 
</html> 

내가 사용할 수 그것을 반향 페이지가 아닌 경우가 " index.php? page "는 존재하지 않지만,"index.php? post_new_band "(아래 코드)와 같이 존재하지 않으면 아무것도 게시되지 않습니다. 서버와 데이터베이스가 작동합니다. 내가 일할 수있는 HTML을 얻으려고 노력하고 있기 때문에 문제 "post_new_band.php"에 대한

코드 :.

<!DOCTYPE html> 
<html> 
<head> 
    <!-- Head Info Goes Here --> 
</head> 
<body> 
    <h1>Insert New Band</h1> 
     <form action='index.php?post_new_band' method='post'> 
      <b>Insert New Band</b><input type='text' name='band_name' /> 
      <b>Insert Band Origin</b><input type='text' name='band_origin' /> 
      <input type='submit' name='insert_band' value='Add Band' /> 
     </form> 

    <?php 
     if (isset($_POST['post_new_band'])){ 
      $band_name = $_POST['band_name']; 

      if($band_name==''){ 
       echo "<script>alert ('Please Insert Band Name')</script>"; 
       echo "<script>window.open('index.php?post_new_band','_self')</script>" 
      } else { 

       $insert_band_name = "insert into Band (band_name) values ('$band_name')"; 

       $run_band_name = mysql_query("$insert_band_name"); 

       echo "<script>alert ('New Category Added')</script>"; 
       echo "<script>window.open('index.php?post_new_band','_self')</script>" 
      } 
     } 
    ?> 
</body> 
</html> 

답변

0

요청 키는 한 번만 사용할 수 있습니다. 동일한 요청에 $_GET['post_new_band']$_POST['post_new_band']을 사용하지 마십시오. 키 중 하나를 변경하십시오.

0

이것은 매우 어리 석었지만 실제로는 세미콜론과 관련된 구문 오류로 밝혀졌습니다. * 얼굴을 때리다.

관련 문제