2016-05-23 8 views
-4

これを修正する方法は本当にわかりません。 このコード行を私のPHPドキュメントに追加するたびに、ページは空白になります。 この問題が発生したことがあるのは誰ですか?PHP/HTML行が空白になる

テーブル内にあります。どうやら、checked_id []の配列です。それを修正する方法がわからない場合、ページが追加されると空白になります。

<td align="center"><input type="checkbox" name='.checked_id[];.' class="checkbox" value='.$row["id"].'</td> 

ここで全体のブロックです。

$output .= ' 
<form name="bulk_action_form" action="delete_multiple.php" method="post" onSubmit="return delete_confirm();"/> 
     <div class="table-responsive"> 
      <table class="table table-bordered"> 
       <tr> 

        <th width="10%">Id</th> 
        <th width="40%">Name</th> 
        <th width="40%">Email</th> 
        <th width="40%">Address</th> 
        <th width="10%">phoneNumber</th> 
        <th width="10%">appointmentTime</th> 
        <th width="10%">appointmentDate</th> 
        <th width="50%">message</th> 
        <th width="10%">delete</th> 
        <th><input type="checkbox" name="select_all" id="select_all" value=""/></th> 
       </tr>'; 



          if(mysqli_num_rows($result) > 0) 
          { 
            while($row = mysqli_fetch_array($result)) 
            { 
             $output .= ' 




       <tr> 

        <td>'.$row["id"].'</td> 
        <td class="name" data-id1="'.$row["id"].'" contenteditable>'.$row["name"].'</td> 
        <td class="email" data-id2="'.$row["id"].'" contenteditable>'.$row["email"].'</td> 
        <td class="address" data-id2="'.$row["id"].'" contenteditable>'.$row["address"].'</td> 
        <td class="phoneNumber" data-id2="'.$row["id"].'" contenteditable>'.$row["phoneNumber"].'</td> 
        <td class="appointmentTime" data-id2="'.$row["id"].'" contenteditable>'.$row["appointmentTime"].'</td> 
        <td class="appointmentDate" data-id2="'.$row["id"].'" contenteditable>'.$row["appointmentDate"].'</td> 
        <td class="message" data-id2="'.$row["id"].'" contenteditable>'.$row["message"].'</td> 
        <td><button type="button" name="delete_btn" data-id3="'.$row["id"].'" class="btn btn-xs btn-danger        btn_delete">Delete</button></td> 
        <td><input type="checkbox" name="'.checked_id[].'" class="checkbox" value="'.$row["id"].'"/></td> 
       </tr> 
      '; 
     }         

} 
else 
{ 

     $output .= '<tr><td colspan="4">Data not Found</td></tr>'; 
} 


$output .= '</table> 
     </div></form>'; 
echo $output; 
?> 

答えて

1

が正しく構成されていない:

  1. は終了タグがありません
  2. 欠落引用符

使用このよう:

<input type="checkbox" name="'.checked_id[].'" class="checkbox" value="'.$row["id"].'"/></td> 
          ^  ^^^     ^   ^^^ 
+0

はまだありません作業。また、私はすでにこれを試しました。私が投稿したものは、私が作った言い伝えの一つです。 –

+0

セミコロンを削除しましたか? – Thamilan

+0

はい、私はセミコロンを削除しました。 –

0

最初にあなたはecho PHP変数をHTMLにしなければなりません.HTMLはそれを理解できないので、名前を書くことはできません。 最初の行に、ほとんどのコードで同じように指定した例を示します。 あなたのコードは:

name='.checked_id[];.' class="checkbox" value='.$row["id"]. 

それがあるべき方法:

もう一つは、私はchecked_id[]は、配列インデックスであるべきだと思う、あなたは空のままにすることはできません。私が間違っているなら、私を修正し、PHPの変数を表示するので、あなたのページ全体でこのサンプルを使用しますが、このname="<?php echo $somevariable; ?>"

のようなHTMLを開いて、そこにあなたの変数をエコーする必要があり、これを試してみてください。

<?php 
$output .= ""; 
?> 
<form name="bulk_action_form" action="delete_multiple.php" method="post" onSubmit="return delete_confirm();"/> 
     <div class="table-responsive"> 
      <table class="table table-bordered"> 
       <tr> 

        <th width="10%">Id</th> 
        <th width="40%">Name</th> 
        <th width="40%">Email</th> 
        <th width="40%">Address</th> 
        <th width="10%">phoneNumber</th> 
        <th width="10%">appointmentTime</th> 
        <th width="10%">appointmentDate</th> 
        <th width="50%">message</th> 
        <th width="10%">delete</th> 
        <th><input type="checkbox" name="select_all" id="select_all" value=""/></th> 
       </tr>'; 
         <?php 


          if(mysqli_num_rows($result) > 0) 
          { 
            while($row = mysqli_fetch_array($result)) 
            { 
             $output .= ' 



         ?> 
       <tr> 

        <td><?php echo $row["id"]; ?></td> 
        <td class="name" data-id1="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["name"]; ?></td> 
        <td class="email" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["email"]; ?></td> 
        <td class="address" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["address"]; ?></td> 
        <td class="phoneNumber" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["phoneNumber"]; ?></td> 
        <td class="appointmentTime" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["appointmentTime"]; ?></td> 
        <td class="appointmentDate" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php $row["appointmentDate"]; ?></td> 
        <td class="message" data-id2="<?php echo $row["id"]; ?>" contenteditable><?php echo $row["message"]; ?></td> 
        <td><button type="button" name="delete_btn" data-id3="<?php echo $row["id"]; ?>" class="btn btn-xs btn-danger        btn_delete">Delete</button></td> 
        <td align="center"><input type="checkbox" name="<?php echo $checked_id[]; ?>" class="checkbox" value="<?php echo $row["id"]; ?>"</td> 
       </tr> 

     } 
+0

コード全体を入れないのは許してください。エコーは必要ありません。私はコードを更新します。それは動作していないアレイです。 –

+0

はい、あなたはPHPですべてをやっていたからですが、それらを分けて、HTMLを使ってスタイリングやPHPをコーディングする必要があります – yahoo5000

関連する問題