2013-04-12 8 views
1

좋아, 그래서 나는 callcenter에서 일하고 있고 우리는 모든 발신자가 찍은 휴식을 보여주는 모니터가 있습니다. 나는이 회사에 처음 왔고 gotton에게이 모니터를위한 웹 사이트를 만들기위한 임무를 부여했습니다.PHP : 게시물 양식이 작동하지 않습니다.

아래는 내 PHP 코드입니다. 문제점이 무엇인지 houres를 검색했지만 찾지 못하는 것 같습니다.

문제는 : 버튼을 클릭하면 내 양식이 게시되지 않고 csv에 쓰지 않습니다. 코드가 올바르게 작동하기 전에 코드가 정확하다는 것을 알았습니다. 어리석은 작은 것이어야하지만 나는 그것을 찾을 수 없다.

내 코드 : 어떤 도움을 주시면 감사하겠습니다

<html> 
<head> 
<LINK REL="StyleSheet" HREF="Input_form.css"> 
<title>Verander Plaatsindeling</title> 
<h1><center>Verander plaatsindeling<center></h1> 
<hr/> 
</head> 
<body> 
    <?php 
     if(ISSET($_POST['submitMe'])) 
     { 
     $csv = fopen("zitplaatsenAntwerpen.csv","w") or die("Kan csv niet vinden!"); 

     for($counter=1;$counter<=30;$counter++) 
     { 
      $naam = $_POST["Naam" .$counter]; 
      $project = $_POST["Project" .$counter]; 
      $csvrow = $counter . ";" . $naam . ";" . $project . "\n"; 
      fwrite($csv, $csvrow); 
     } 
    ?> 
    <?php 
      fclose($csv); 
      echo "<SCRIPT LANGUAGE='JavaScript'> 
      <!-- 
      window.alert('Gegevens ingeladen!') 
      // --> 
      </SCRIPT>"; 
      $informatie = array(); 
      $f = fopen("ZitplaatsenAntwerpen.csv","r") or die("Kan csv niet vinden!"); 

      while (!feof($f)) 
      { 
       $arrM = explode(";",fgets($f)); 
       $informatie[$arrM[0]]["Nummer"] = ucwords($arrM[0]); 
       $informatie[$arrM[0]]["Naam"] = ucwords($arrM[1]); 
       $informatie[$arrM[0]]["Project"] = ucwords($arrM[2]); 
      } 
      fclose($f); 
     } 
     else 
     { 
      $informatie = array(); 
      $f = fopen("ZitplaatsenAntwerpen.csv", "r") or die("Kan csv niet vinden!"); 

      while (!feof($f)) 
      { 
      $arrM = explode(";",fgets($f)); 
      $informatie[$arrM[0]]["Nummer"] = ucwords($arrM[0]); 
      $informatie[$arrM[0]]["Naam"] = ucwords($arrM[1]); 
      $informatie[$arrM[0]]["Project"] = ucwords($arrM[2]); 
      } 
      fclose($f); 
     } 
    ?> 
    <div style="word-spacing:7em;" align:center> 
     Nummer Naam Project 
    </div> 

    <pre><form action="<?php echo $PHP_SELF;?>" method="post"> 
    <?php 
     for ($teller = 1;$teller<=30; $teller++) 
     { 
       if(!empty($informatie[$teller])) 
       { 
        echo "<div align:center>"; 
        echo "  " . $teller . " "; 
        echo "<input type='text' name='Naam" .$teller. "' value='"; 
        echo $informatie[$teller]["Naam"] . "'>"; 
        echo "<input id='" .$teller. "' "; 
        echo "<input type='text' name='Project" .$teller. "' value='"; 
        echo $informatie[$teller]["Project"] . "'>"; 
        echo "</div>"; 
       } 
       else 
       { 
        echo "<div align:center>"; 
        echo "  " . $teller . " "; 
        echo "<input type='text' name='Naam" .$teller. "' value='"; 
        echo $informatie[$teller]["Naam"] . "'>"; 
        echo "<input id='" .$teller. "' "; 
        echo "<input type='text' name='Project" .$teller. "' value='"; 
        echo $informatie[$teller]["Project"] . "'>"; 
        echo "</div>"; 
       } 
     } 
    ?> 
    </form></pre> 
<div align="center"> 
<button style="width:100;height:50" type="submit" name="submitMe">Opslaan</button> 
</div> 
</body> 
</html> 

. 미리 감사드립니다.

답변

2

변경이 PHP

if(ISSET($_POST['submitMe'])) 

이 번호 :

if(isset($_POST['submitMe'])) 
<input type="submit" style="width:100;height:50" name="submitMe" value="Opslaan"> 
</form> 
+1

아 하느님 ... 나는 4 houres 롤에 대한 그걸 쳐다 보 ... 고마워 너무 많은 동료가 – user2274703

+1

당신이 문제를 해결했다면 대답을 받아 들일 수 있습니다 –

+0

내가 코멘트를 upvote UR하지만 내가 할 수 없다 : p는 여전히 – user2274703

1

제출 버튼이 <form> 태그 밖에 있습니다. 페이지의 소스에서보고 된대로 렌더링 될 알 수 있습니다 :

<form> 
.... 
</form> 
<button...> 

button과 같이 양식 태그 내부에 살아야한다 :

<form> 
<button ...> 
</form> 
+0

하나를 사용해야합니다 : 14,이 같은 것을 만들려고 폐쇄 양식 후 버튼을 제출하여 뒀다 잘못을 설명하는 방법. – Vinay

0

이 코드는 잘못이

<button style="width:100;height:50" type="submit" name="submitMe">Opslaan</button> 

당신은 영원히

<input style="width:100;height:50" type="submit" name="submitMe" value="Opslaan" /> 
관련 문제