English 中文(简体)
传真 表2. 住房价格指数
原标题:HTML Tables not visible, from PHP code
  • 时间:2012-04-17 05:03:44
  •  标签:
  • php
  • html

我试图成为网页的一部分,这基本上表明用户加入哪组。 我想就表格组提出一个表格,为拥有的集团再提出一个表格,这两个表格都是另一个较大表格的行文。 但是,我尝试的小组却未能表现出来,而集团拥有的集团正在完全进行。 为什么会发生这种情况? 我是否应当制定员额守则?

<table width="90%" height="125" >

<tr  bgcolor="#CCCCCC"><td height="20" colspan="2"><h4>Groups</h4>
 </td></tr>
 <tr bgcolor="#CCCCCC">
  <?
   if($accountid == $_SESSION[ userid ])

 { 

  ?>
    <td width="50%">
    <form name="groupscreate" method="post" onsubmit="return Confirm()">
     <table width="99%" height="6%"  bgcolor="#CCCCCC"> <tr valign="top">

      <td colspan="3"><h5>Create Groups</h5></td></tr>
       <tr><td>

   <input align="absmiddle" type="text" maxlength="25" name="gname" /><? if($nog==1)    {echo "<br /><font color=red>Please enter a valid groupname</font>";}?></td>
   <td><select name="gcategory"> 
                <option value="General" selected>General</option> 
                <option value="Comedy">Comedy</option> 
                <option value="Education">Education</option> 
                <option value="Entertainment">Entertainment</option> 
                <option value="Gaming">Gaming</option> 
                <option value="Music">Music</option> 
                <option value="Science & Technology">Science & Technology</option> 
                <option value="Sports">Sports</option> 
        </select></td><td><input type="submit" name="makegroup"           value="create group"/></td></tr>
 </table>
 </form>
 </td>
 <?
  }

 $grp= "SELECT * from groups where accountid= ". $accountid." ";
  $rest = mysql_query($grp,$connection);
  $cont=0;
  ?>
  <td width="50%" >
   <table width="100%" height="20%" bgcolor="#CCCCCC" >
    <tr><td colspan="10"><h5>Groups Owned</h5>
   </td></tr>
 <?
  while($grow=mysql_fetch_array($rest))
    { 

   $cont=$cont+1;
   $gid=$grow[ groupid ];
   $gnam=$grow[ groupname ];
   $gcreator=$grow[ accountid ];
    if($cont==0)
        {
    echo "<tr>"; 
        }


 echo "<td align= left  ><a href= groups_discussions.php?id=".$gid." ><font          color="."#333333"." size= -1 >".$gnam."</font></a></td>";


        if($cont==5)
        {echo "</tr>";}
    } 

  ?>
     </table>
    </td>

    </tr></table>

我想知道,一切都看着你们的一切权利。 我可以看到任何错误,但事实是,形式没有显示:

最佳回答

你们也这样说?

<table width="90%" height="125" bgcolor="orange">
<tr  bgcolor="#CCCCCC"><td height="20" colspan="2"><h4>Groups</h4></td></tr>
<tr bgcolor="#CCCCCC">
    <td width="50%">
    <form name="groupscreate" method="post" onsubmit="return Confirm()">
        <table width="99%" height="6%"  bgcolor="green"> 
            <tr valign="top">
                <td colspan="3"><h5>Create Groups</h5></td>
            </tr>
            <tr bgcolor="blue">
                <td bgcolor="orange">
                    <input align="absmiddle" type="text" maxlength="25" name="gname" />
                    <?php 
                        $nog = 1;
                        if($nog == 1)    
                            echo "<br /><font color=red>Please enter a valid groupname</font>";
                    ?>
                </td>
                <td bgcolor="yellow">
                    <select name="gcategory"> 
                        <option value="General" selected>General</option> 
                        <option value="Comedy">Comedy</option> 
                        <option value="Education">Education</option> 
                        <option value="Entertainment">Entertainment</option> 
                        <option value="Gaming">Gaming</option> 
                        <option value="Music">Music</option> 
                        <option value="Science & Technology">Science & Technology</option> 
                        <option value="Sports">Sports</option> 
                    </select>
                </td>
                <td bgcolor="red">
                    <input type="submit" name="makegroup" value="create group"/>
                </td>
            </tr>
        </table>
    </form>
    </td>
    <td width="50%">
        <table width="100%" height="20%" bgcolor="pink" >
        <tr><td colspan="10"><h5>Groups Owned</h5></td></tr>
            <?php
            //$grp= "SELECT * from groups where accountid= ". $accountid." ";
            //$rest = mysql_query($grp, $connection);
            $rest = array(
                        array( groupid  =>  123 ,  groupname  =>  testname ,  accountid  =>  456 ), 
                        array( groupid  =>  678 ,  groupname  =>  testname2 ,  accountid  =>  999 )
                        );
            $cont = 0;
            foreach ($rest as $grow)
            {
                $gid = $grow[ groupid ];
                $gnam = $grow[ groupname ];
                $gcreator = $grow[ accountid ];

                if($cont == 0)
                    echo "<tr>"; 

                echo "<td align= left  ><a href= groups_discussions.php?id=" . $gid . " ><font color="."#333333"." size= -1 >" . $gnam . "</font></a></td>";

                if($cont == 1)
                    echo "</tr>";
                $cont = $cont + 1;
            }
            ?>
        </table>
    </td>
</tr>

</table>
问题回答

你在你的法典中存在一些问题,例如,只有能够处理第二张表格中的一套5个结果,加固反面(因此其最低价值总是为1个),然后测试看它是否为零等等。

<table width="90%" height="125" >
  <tr bgcolor="#CCCCCC">
    <td height="20" colspan="2">
      <h4>Groups</h4>
    </td>
  </tr>
  <tr bgcolor="#CCCCCC">
<?
if( isset( $_SESSION[ userid ] ) && $accountid==$_SESSION[ userid ] ){ 
?>
    <td width="50%">
      <form name="groupscreate" method="post" onsubmit="return Confirm()">
        <table width="99%" height="6%"  bgcolor="#CCCCCC">
          <tr valign="top">
            <td colspan="3">
              <h5>Create Groups</h5>
            </td>
          </tr>
          <tr>
            <td>
              <input align="absmiddle" type="text" maxlength="25" name="gname" />
<?
  if( $nog==1 ){
?>
              <br /><font color="red">Please enter a valid groupname</font>
<?php
  }
?>
            </td>
            <td>
              <select name="gcategory"> 
                <option value="General" selected>General</option> 
                <option value="Comedy">Comedy</option> 
                <option value="Education">Education</option> 
                <option value="Entertainment">Entertainment</option> 
                <option value="Gaming">Gaming</option> 
                <option value="Music">Music</option> 
                <option value="Science & Technology">Science &amp; Technology</option> 
                <option value="Sports">Sports</option> 
              </select>
            </td>
            <td>
              <input type="submit" name="makegroup" value="create group" />
            </td>
          </tr>
        </table>
      </form>
    </td>
<?
}

$grp = "SELECT * from groups where accountid= {$accountid} ";
$rest = mysql_query( $grp , $connection );
$cont = 0;
?>
    <td width="50%" >
      <table width="100%" height="20%" bgcolor="#CCCCCC" >
        <tr>
          <td colspan="10">
            <h5>Groups Owned</h5>
          </td>
        </tr>
<?
if( mysql_num_rows( $rest )>0 ){
  while( $grow = mysql_fetch_array( $rest ) ){
    $gid = $grow[ groupid ];
    $gnam = $grow[ groupname ];
    $gcreator = $grow[ accountid ];
    if( ( $cont%5 )==0 )
      echo  <tr> ;

    echo "<td align= left  ><a href= groups_discussions.php?id={$gid} ><font color= #333333  size= -1 >{$gnam}</font></a></td>
";

    if( ( $cont%5 )==4 )
      echo  </tr> ;

    $cont++;
  }
}else{
  echo  <tr><td colspan="10">No Records</td></tr> ;
}
?>
      </table>
    </td>
  </tr>
</table>

Might help.

核对这一条件是否匹配:if ($accountid =_$_SESSION[使用]

如果它不匹配,那么集团的形式就会明显。

我把你的法典放在了一条更好的可读性轨道上:

    <table width="90%" height="125" >
    <tr  bgcolor="#CCCCCC">
        <td height="20" colspan="2"><h4>Groups</h4></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <?
        if($accountid == $_SESSION[ userid ])
        { 
    ?>
        <td width="50%">
            <form name="groupscreate" method="post" onsubmit="return Confirm()">
                <table width="99%" height="6%"  bgcolor="#CCCCCC"> 
                    <tr valign="top">
                        <td colspan="3"><h5>Create Groups</h5></td>
                    </tr>
                    <tr>
                        <td>
                            <input align="absmiddle" type="text" maxlength="25" name="gname" />
                            <? if($nog==1)    {echo "<br /><font color=red>Please enter a valid groupname</font>";}?>
                        </td>
                        <td>
                            <select name="gcategory"> 
                                <option value="General" selected>General</option> 
                                <option value="Comedy">Comedy</option> 
                                <option value="Education">Education</option> 
                                <option value="Entertainment">Entertainment</option> 
                                <option value="Gaming">Gaming</option> 
                                <option value="Music">Music</option> 
                                <option value="Science & Technology">Science & Technology</option> 
                                <option value="Sports">Sports</option> 
                            </select>
                        </td>
                        <td>
                            <input type="submit" name="makegroup" value="create group"/>
                        </td>
                    </tr>
                </table>
            </form>
        </td>
    <?
        }

        $grp= "SELECT * from groups where accountid= ". $accountid." ";
        $rest = mysql_query($grp,$connection);
        $cont=0;
    ?>
        <td width="50%" >
            <table width="100%" height="20%" bgcolor="#CCCCCC" >
                <tr>
                    <td colspan="10"><h5>Groups Owned</h5></td>
                </tr>
                <?
                while($grow=mysql_fetch_array($rest))
                { 
                    $cont=$cont+1;
                    $gid=$grow[ groupid ];
                    $gnam=$grow[ groupname ];
                    $gcreator=$grow[ accountid ];
                    if($cont==0)
                        echo "<tr>"; 

                    echo "<td align= left  ><a href= groups_discussions.php?id=".$gid." ><font          color="."#333333"." size= -1 >".$gnam."</font></a></td>";

                    if($cont==5)
                        echo "</tr>";
                } 
                ?>
            </table>
        </td>

    </tr>
</table>

少有:

(1) ......

 $cont=$cont+1;
 $gid=$grow[ groupid ];
 $gnam=$grow[ groupname ];
 $gcreator=$grow[ accountid ];
 if($cont==0)
    {
    echo "<tr>"; 
    }

......自第一次停用1美元后,如果说话,则永远不会火灾。 (单位:0+1=1)

(2) 您在以下几页之后需要重新编号:if($cont=5){echo“</tr>>;>>>;,这样,发言稿的顶部就可形成一个新的<代码><tr>。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签