Jump to content
Fórum Script Brasil
  • 0

Organizar Tabelas


Nill
 Share

Question

Pessoal, estou iniciando agora em PHP e estou fazendo um trabalho pra faculdade, conseguir seguir um tutorial pra fazer um carrinho de compra, porém estou apanhando pra colocar os itens um debaixo do outro.

http://www.vigacaldeiraria.com.br/pim/index.php SITE

Bom como podem ver na pagina acima, são 4 itens que serão exibidos na tela, queria que ficassem um debaixo do outro, e não da forma que está, ao lado.

Se alguém pudesse me ajudar e me explicar como faz....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
    <title>UnilesteMG - Sistemas de Informação</title>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</head>

<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#E6E6E6">

<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr valign="top">
    <td><img src="images/logo.gif" alt="" width="184" height="129" border="0"></td>
    <td>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
    <td colspan="2">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
    <td><img src="images/but01.gif" width="115" height="30" alt="" border="0"></td>
    <td><img src="images/but02.gif" alt="" width="114" height="30" border="0"></td>
    <td><img src="images/but03.gif" width="112" height="30" alt="" border="0"></td>
    <td><img src="images/but04.gif" width="116" height="30" alt="" border="0"></td>
    <td><img src="images/but05.gif" width="117" height="30" alt="" border="0"></td>
</tr>
</table>    
    </td>
</tr>
<tr>
    <td background="images/fon_top01.gif" colspan="2" height="37">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="">
<tr>
    <td><p class="menu01"><a href=""><img src="images/e01.gif" width="8" height="7" alt="" border="0">  Company history</a></p></td>
    <td><p class="menu01"><a href=""><img src="images/e01.gif" width="8" height="7" alt="" border="0">  Executives management</a></p></td>
    <td><p class="menu01"><a href=""><img src="images/e01.gif" width="8" height="7" alt="" border="0">  Contact Info</a></p></td>
    <td><p class="menu01"><a href=""><img src="images/e01.gif" width="8" height="7" alt="" border="0">  Our Partners</a></p></td>
    <td><p class="menu01"><a href=""><img src="images/e01.gif" width="8" height="7" alt="" border="0">  Contacts</a></p></td>
</tr>
</table>
    </td>
</tr>
<tr>
    <td><img src="images/form01.gif" width="341" height="22" alt="" border="0"></td>
    <td><img src="images/form02.gif" width="233" height="22" alt="" border="0"></td>
</tr>
<tr>
<form action="" method="post">
    <td height="40" background="images/form03.gif" width="341" alt="" border="0" align="center">
<input type="Text" name="" value=" USERNAME" size="10">
<input type="Text" name="" value=" PASSWORD" size="10">
<input type="image" src="images/b_login.gif" width="79" height="20" alt="" border="0" align="absbottom">
    </td>
    </form>
    <td background="images/form04.gif" width="233" height="40">
<table border="0" cellpadding="0" cellspacing="0" width="100%" background="">
<tr align="center">
    <td><p style="color: #FFFFFF; font-size: 10px;"><b>TOTAL<br>$11500,00</b></p></td>
    <td><a href=""><img src="images/b_vew.gif" width="79" height="20" alt="" border="0"></a></td>
</tr>
</table>
    </td>
</tr>
</table>
    </td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr valign="top">
    <td width="185" background="images/fon_left03.gif">
<table border="0" cellpadding="0" cellspacing="0" background="images/fon_left01.gif" width="100%">
<tr>
    <td align="right">
<table border="0" cellpadding="0" cellspacing="0" width="165" background="images/fon_left02.gif">
<tr>
    <td background="images/left01.gif" height="26"><p class="title">COMPONENTES</p></td>
</tr>
<tr>
    <td>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Motherboards</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Processador</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Memoria</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Hard Drivers</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Monitores</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Case</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">UPS</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Cards</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">CD/CDR</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Data Storage</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Multimedia</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Removable Storage</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Scanners/drivers</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Hubs and Routers</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Speakers</a></p>
<div align="center"><img src="images/hr01.gif" width="137" height="3" alt="" border="0"></div>
<p class="b01"><img src="images/e02.gif" width="6" height="5" alt="" border="0" align="absmiddle">  <a href="">Sofware</a></p>
    </td>
</tr>
<tr>
    <td><img src="images/left_bot02.gif" width="165" height="18" alt="" border="0"></td>
</tr>
</table>    
<br>
<table border="0" cellpadding="0" cellspacing="0" width="165" background="images/fon_left02.gif">
<tr>
    <td background="images/left02.gif" height="26" width="165" colspan="3"><p class="title">
    PIM</p></td>
</tr>
<tr>
    <td width="12">
 </td>
    <td width="145">
<a href="http://www.unilestemg.br/">
<img border="0" src="images/unileste.jpg" width="145" height="133"></a></td>
    <td width="8">
 </td>
</tr>
</form>
<tr>
    <td width="165" colspan="3"><img src="images/left_bot02.gif" width="165" height="18" alt="" border="0"></td>
</tr>
</table>    
    </td>
</tr>
<tr>
    <td><img src="images/left_bot01.gif" width="185" height="32" alt="" border="0"></td>
</tr>
</table>
    </td>
    <td bgcolor="#FFFFFF" width="572">
<div align="center"><img src="images/m_top.gif" width="572" height="8" alt="" border="0"></div>
<p class="px5">
<table border="0" cellpadding="0" cellspacing="0" width="95%" align="center" height="25" background="images/fon_bar01.gif">
<tr>
    <td>
<table border="0" cellpadding="0" cellspacing="0" background="" bgcolor="#FFFFFF">
<tr>
    <td><img src="images/e03.gif" width="21" height="21" alt="" border="0" align="left"></td>
    <td><p class="bar01" style="color: #DA0008; font-size: 18px;">Today’s special </p></td>
</tr>
</table>
    </td>
</tr>
</table>
<table border="0" cellpadding="3" cellspacing="0" align="center">
<tr valign="top">
    <td><?
//INICIALIZA A SESSÃO
session_start();

//MONTA O ARRAY DE PRODUTOS
$produto[1][CODIGO]     =   "00001";
$produto[1][ARTISTA]     =   "Maulaz";
$produto[1][ALBUM]       =   "Teste de nome do cd";
$produto[1][preço]       =   "90,80";
$produto[1][IMAGEM]      =   "carrinho/cpm22.jpg";

$produto[2][CODIGO]     =   "00002";
$produto[2][ARTISTA]     =   "Offspring";
$produto[2][ALBUM]       =   "Splinter";
$produto[2][preço]       =   "28,35";
$produto[2][IMAGEM]      =   "carrinho/offspring.jpg";

$produto[3][CODIGO]     =   "00003";
$produto[3][ARTISTA]     =   "Detonautas";
$produto[3][ALBUM]       =   "Roque Marciano";
$produto[3][preço]       =   "27,00";
$produto[3][IMAGEM]      =   "carrinho/detonautas.jpg";

$produto[4][CODIGO]     =   "00004";
$produto[4][ARTISTA]     =   "Good Charlotte";
$produto[4][ALBUM]       =   "The Young And The Hopeless";
$produto[4][preço]       =   "30,00";
$produto[4][IMAGEM]      =   "carrinho/charlotte.jpg";


//TOTAL DE PRODUTOS POR LINHA
$total = 2;
?>

<html>
<head>
<title>PIM 3º Período</title>
<style type="text/css">
<!--
body {
    margin-left: 0px;
    margin-top: 0px;
    margin-right: 0px;
    margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="773"  border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td> <br>
    
    <br>
        
    <form action="carrinho.php" method="post" name="frmcarrinho">
       <input type="hidden" name="opc_efetivar" value="1">

       <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0"> 
       <tr>
       <?
       //PEGA A CHAVE DO ARRAY
       $chave = array_keys($produto);
       
       //EXIBE OS PRODUTOS
        for($i=0; $i<sizeof($chave); $i++) {
           $indice    =   $chave[$i];
           $codigo    =   $produto[$indice][CODIGO];
           $artista   =   $produto[$indice][ARTISTA];
           $album     =   $produto[$indice][ALBUM];
           $preço     =   $produto[$indice][preço];
           $imagem    =   $produto[$indice][IMAGEM]; 
           
           //VERIFICA
           if($total == $atual) {
              echo "</tr><tr>";
              $atual = 0;
           } ?> 
           
          <td width="14%" height="100"><img src="<? echo $imagem; ?>" width="80" height="80" border="1"></td>
          <td width="36%">
          
          <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
             <td><font face='Arial' size='2'><? echo $artista; ?></font></td>
          </tr>
          
          <tr>
             <td><font face='Arial' size='2'><? echo $album; ?></font></td>
          </tr>
          
          <tr>
             <td><font face='Arial' size='2'>R$ <? echo $preço; ?></font></td>
          </tr>
          
          <tr>
             <td>
             <input type="hidden" name="txtprod[<? echo $indice;?>][CODIGO]"  value="<? echo $codigo; ?>">
             <input type="hidden" name="txtprod[<? echo $indice;?>][ARTISTA]"  value="<? echo $artista; ?>">
             <input type="hidden" name="txtprod[<? echo $indice;?>][ALBUM]"  value="<? echo $album; ?>">
             <input type="hidden" name="txtprod[<? echo $indice;?>][preço]"  value="<? echo $preço; ?>">
             <input type="text" name="txtprod[<? echo $indice;?>][QTDE]"  size="3" maxlength="3">     
             <input type="image" src="images/carrinho.gif" onClick="java script: document.forms[0].submit();"></td>
          </tr>
          </table></td>
          <?
          //SOMA 1 A VARIÁVEL CONTROLADORA
          $atual++;
       }//FEHA FOR ?>
       </tr>
       </table>   
    </form></td>
  </tr>
  </table>
</body>
</html>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="95%" align="center" height="25" background="images/fon_bar01.gif">
<tr>
    <td>
<table border="0" cellpadding="0" cellspacing="0" background="" bgcolor="#FFFFFF">
<tr>
    <td><img src="images/e05.gif" width="21" height="21" alt="" border="0"></td>
    <td><p class="bar01" style="color: #4AC250; font-size: 18px;">Top News </p></td>
</tr>
</table>
    </td>
</tr>
</table>
<p class="px5">
<table border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
    <td width="275">
<p class="left"><img src="images/dot_b.gif" width="5" height="5" alt="" border="0" align="absmiddle">  <b>Lorem ipsum dolor sit amet, consectetuer</b></p>
<p class="left">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.</p>
<p class="left"><a href="">Read More</a></p>
    </td>
    <td bgcolor="#979797"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
    <td width="275">
<p class="left"><img src="images/dot_b.gif" width="5" height="5" alt="" border="0" align="absmiddle">  <b>Lorem ipsum dolor sit amet, consectetuer</b></p>
<p class="left">Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh commodo consequat.</p>
<p class="left"><a href="">Read More</a></p>
    </td>
</tr>
</table>
<p class="px5">
    </td>
    <td bgcolor="#979797"><img src="images/px1.gif" width="1" height="1" alt="" border="0"></td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="758" align="center">
<tr>
    <td height="52" align="right" background="images/bot.gif">
<table border="0" cellpadding="0" cellspacing="0" width="530" background="">
<tr>
    <td>
<p class="menu02">
<a href="">Home</a>      
<a href="">About Us</a>      
<a href="">Support</a>      
<a href="">Services</a>      
<a href="">Contacts</a>      
<a href="">Help</a>      
<a href="">FAQ</a>
</p>
    </td>
</tr>
</table>
    </td>
</tr>
<tr>
    <td><p align="right" style="margin-right: 200px;">Copyright ©2007 Trabalho 
    de PIM 3º Período Sistemas - UnilesteMG</p></td>
</tr>
</table>

<html>

<body leftmargin=0 topmargin=0 marginheight="0" marginwidth="0" bgcolor="#ffffff">

</body></html>
</body>
</html>

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

O código fonte do artigo original tem uma parte que configura o número de colunas... até está no seu.. só não vou falar qual é pra você ter o trabalho de ler o código que pegou no IMasters...

MANTENHA OS CRÉDITOS!

Link to comment
Share on other sites

  • 0

Caros colegas, me desculpem pela vergonha que passei.. Era uma coisa tão obvia, com relação aos créditos, tenho que fazer um relatório e colocar a fonte de pesquisa, obrigatoriamente tenho que colocar o endereço de onde eu peguei o código.

Vou estar tentando mudar outras coisa e estarei aqui novamente para pedir as suas ajudas novamente.

Desde já agradeço a todos e mais uma vez, peço desculpas pela ingenuidade.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.2k
    • Total Posts
      647.5k
×
×
  • Create New...