Jump to content


Photo

Problema Em Código


  • Faça o login para participar
18 replies to this topic

#1 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 11/06/2004, 11:46

Pessoal, fiz uma loja virtual com este endereço:
www.acalifaflores.com.br
Olha o erro que dá:

Notice: Undefined index: $i in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 92

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 93

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 94

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 95

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 96

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 97

 

R$ 
     

Notice: Undefined index: $i in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 92

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 93

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 94

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 95

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 96

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 97

 

R$ 
     

Notice: Undefined index: $i in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 92

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 93

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 94

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 95

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 96

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 97

 

R$ 
     

Notice: Undefined index: $i in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 92

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 93

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 94

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 95

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 96

Notice: Undefined index: $indice in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\index.php on line 97


Vou postar o código destas linhas:
$indice    =   $chave["$i"];
     $codigo    =   $produto["$indice"]["CODIGO"];
     $artista   =   $produto["$indice"]["ARTISTA"];
     $album     =   $produto["$indice"]["ALBUM"];
     $preco     =   $produto["$indice"]["PRECO"];
     $imagem    =   $produto["$indice"]["IMAGEM"];

Alguem sabe como solucionar?
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#2 Prog

Prog

    ...

  • Ex-Admins
  • 3761 posts
  • Sexo:Masculino
  • Localidade:Rio de Janeiro/RJ
  • Interesses:TI, Software Livre, Design Digital e Rock'n'Roll.

Posted 11/06/2004, 12:00

A resolução do problema poderá ser mais precisa se postar o código completo.
------
Mero mortal!

#3 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 11/06/2004, 12:01

<?
/************************************************************************
ARQUIVO .........: Carrinho de compras simples: usado  no web site da Acalifa Flores
BY ..............: Guilherme Moreira Lizardo - guilhermeboby@ibest.com.br
************************************************************************/
//MONTA O ARRAY DE PRODUTOS
$produto[1]['CODIGO']     =  "00001";
$produto[1]['ARTISTA']     =   "Arranjo Amarelo de Flores";
$produto[1]['ALBUM']       =   "Arranjos";
$produto[1]['PRECO']       =   "15,25";
$produto[1]['IMAGEM']      =   "../floriculturas/arranjoamarelo.jpg";

$produto[2]['CODIGO']     =   "00002";
$produto[2]['ARTISTA']     =   "Arranjo Bambus";
$produto[2]['ALBUM']       =   "Arranjos";
$produto[2]['PRECO']       =   "28,35";
$produto[2]['IMAGEM']      =   "../floriculturas/arranjocombambus.jpg";

$produto[3]['CODIGO']     =   "00003";
$produto[3]['ARTISTA']     =   "Canteiro - Completo";
$produto[3]['ALBUM']       =   "Canteiros";
$produto[3]['PRECO']       =   "75,99";
$produto[3]['IMAGEM']      =   "../floriculturas/canteiro.jpg";

$produto[4]['CODIGO']     =   "00004";
$produto[4]['ARTISTA']     =   "Coqueiros";
$produto[4]['ALBUM']       =   "Árvores";
$produto[4]['PRECO']       =   "30,00";
$produto[4]['IMAGEM']      =   "../floriculturas/cantocoqueirinhos.jpg";


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

?>

<html>
<head>
<title>Vendas</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
<STYLE type="text/css">
<!--
BODY {
scrollbar-face-color: #000000;
scrollbar-highlight-color: #FFFFFF;
scrollbar-3dlight-color: #C0C0C0;
scrollbar-darkshadow-color: #404040;
scrollbar-shadow-color: #808080;
scrollbar-arrow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
}
-->
</STYLE>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#FFCC99">
<table width="773"  border="0" cellspacing="0" cellpadding="0">
   <tr>
    <td> <br>
    <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td align='center'><div align="left"><font face='Arial' size='4'><b>Vendas</b></font></div></td>
      </tr>
    </table>
    <br>
    <br>
    <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td><font face='Arial' size='2'>Confira abaixo, os &uacute;ltimos produtos 
            selecioandos no site:</font></td>
      </tr>
    </table>
    <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"];
     $preco     =   $produto["$indice"]["PRECO"];
     $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 $preco; ?></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;?>][PRECO]"  value="<? echo $preco; ?>">
    <input type="text" name="txtprod[<? echo $indice;?>][QTDE]"  size="3" maxlength="3">  
             <input type="image" src="carrinho.gif" onClick="javascript: document.forms[0].submit();"></td>
          </tr>
          </table></td>
       <?
       //SOMA 1 A VARIÁVEL CONTROLADORA
       $atual++;
    }//FEHA FOR ?>
       </tr>
       </table>
    </form></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Aqui está ele completo!!!
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#4 Prog

Prog

    ...

  • Ex-Admins
  • 3761 posts
  • Sexo:Masculino
  • Localidade:Rio de Janeiro/RJ
  • Interesses:TI, Software Livre, Design Digital e Rock'n'Roll.

Posted 11/06/2004, 12:23

Cara...
aqui, no meu servidor local, este script funcionou sem gerar erro algum.
------
Mero mortal!

#5 Goku Jr

Goku Jr

    Nilson

  • Usuários
  • 3757 posts
  • Sexo:Masculino

Posted 11/06/2004, 12:33

eee aqui também não está dando nenhum erro !

mas .. esse arquivo aê e o index.php dessa pasta [\web\vendas] ?

se não abre o index.php que se localiza dentro desta pasta e coloca aê as linhas que estão dando erro [ 92,93,94,95,96,97 ]

até + !!!
-----------------------------------------------------------------------
PALMEIRAS - Primeiro campeão do mundo em 1951

#6 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 11/06/2004, 21:37

Aqui está:

$indice    =  $chave["$i"];
    $codigo    =  $produto["$indice"]["CODIGO"];
    $artista  =  $produto["$indice"]["ARTISTA"];
    $album    =  $produto["$indice"]["ALBUM"];
    $preco    =  $produto["$indice"]["PRECO"];
    $imagem    =  $produto["$indice"]["IMAGEM"]; 

Em casa funfa normal, mais no server não?
Como faço?
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#7 Troyan

Troyan

    12 Horas

  • Usuários
  • 285 posts
  • Sexo:Não informado
  • Localidade:Mesquita, Rio de Janeiro - Brasil
  • Interesses:Sou programador ASP, PHP, Javascript e ActionScript, além de ser curioso em JSP, ColdFusion e XSL. Trabalho com XML, XHTML, adoro webstandards e a W3C. Também trabalho com tableless e RIA's.<br><br> Formas de contato:<br> Email: dnunes[at]gmail[dot]com<br> ICQ: 68102402<br> MSN: troyandev@hotmail.com<br><br> -------------------------------------<br> - Rio de Janeiro, Brazil<br> - Troyan

Posted 11/06/2004, 23:05

Tira as aspas, infeliz! :D

Ninguém notou que tá com aspas nas variáveis? Se é um $i, ele é uma variável, logo, não fica entre aspas. O mesmo serve pro $indice.

[]s
~~ ~
diego nunes
web engineer

~ ~~

#8 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 12/06/2004, 19:57

Velinho, o script index.php funfou
Mas tenta fazer uma compra
Já tentei com,sme aspas,tentei tudo e não funfaolha só, na página carrinho.php:
Carrinho.php
<?

session_start();

if('$_POST['opc_atualizar']') {
   
   //RECEBE OS PRODUTOS CHECADOS PARA ATUALIZAÇÃO
   $v_atualiza  =  $_POST['a_prod'];
   
   //PEGA A CHAVE DO ARRAY
   $chave  =  array_keys('$v_atualiza');
   
   //EXIBE
   for($i=0; $i<sizeof('$chave'); $i++) {
   //PEGA O INDICE DO PRODUTO
   $indice   =   $chave['$i'];
   
   //ALTERA A QUANTIDADE DO PRODUTO SELECIONADO
   $_SESSION['cesta']['$indice']['QTDE']   =  $v_atualiza['$indice']['QTDE'];
   }//FECHA FOR
}//FECHA IF


//VERIFICA SE A OPÇÃO EXCLUIR FOI SELECIONADA
elseif('$_POST['opc_excluir']') {
   
   //RECEBE OS PRODUTOS CHECADOS PARA EXCLUSÃO
   $excluir  =  $_POST['check'];
   
   //EXIBE
   for($i=0; $i<sizeof('$excluir'); $i++) {
   //PEGA O INDICE DO PRODUTO
   $indice   =   $excluir['$i'];
   //DESTRÓI A VARIÁVEL ESPECIFICADA
   unset($_SESSION['cesta']['$indice']);
   }//FECHA FOR
}//FECHA IF



//RECEBE O PEDIDO DO USUÁRIO
elseif($_POST['opc_efetivar']) {
   //RECEBE AS VARIÁVEIS
   $v_prod  =  $_POST['txtprod'];
   
   //PEGA A CHAVE DO ARRAY
   $chave  =  array_keys($v_prod);

   //EXIBE
   for($i=0; $i<sizeof('$chave'); $i++) {
      $indice  =  $chave["$i"];
      
      //VERIFICA
      if(!empty($v_prod['$indice']['QTDE'])) {
      
      //GRAVA NO ARRAY CESTA
      $cesta[$indice][ARTISTA]  =    $v_prod[$indice][ARTISTA];
      $cesta[$indice][ALBUM]    =    $v_prod[$indice][ALBUM];
      $cesta[$indice][PRECO]    =    $v_prod[$indice][PRECO];
      $cesta[$indice][QTDE]     =    $v_prod[$indice][QTDE];
      }//FECHA IF
   }//FECHA FOR
   
   //GRAVA NA SESSÃO
   $_SESSION['cesta']        =   $cesta;
}//FECHA ELSE
//VERIFICA SE TEM PRODUTO NO CARRINHO PARA PUXAR
  if(count($_SESSION['cesta']) > 0) { 
    //PEGA A CHAVE DO ARRAY
    $chave = array_keys($_SESSION['cesta']);

   //PEGA OS DADOS DA SESSÃO
   for($i=0; $i<sizeof('$chave'); $i++) { 
     //ÍNDICE
     $indice = $chave['$i']; 

    //ATRIBUI
    $cesta['$indice']['ARTISTA'] = $_SESSION['cesta']['$indice']['ARTISTA'];
    $cesta['$indice']['ALBUM'] = $_SESSION['cesta']['$indice']['ALBUM'];
    $cesta[$indice]['PRECO'] = $_SESSION['cesta']['$indice']['PRECO'];
    $cesta[$indice]['QTDE'] = $_SESSION['cesta']['$indice']['QTDE'];
  }//FECHA FOR
}//FECHA IF

?>

<html>
<head>
<title>Carrinho</title>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style2 {
	color: #000000;
	font-weight: bold;
}
.style5 {color: #FFFFFF; font-weight: bold; }
-->
<STYLE type="text/css">
<!--
BODY {
scrollbar-face-color: #000000;
scrollbar-highlight-color: #FFFFFF;
scrollbar-3dlight-color: #C0C0C0;
scrollbar-darkshadow-color: #404040;
scrollbar-shadow-color: #808080;
scrollbar-arrow-color: #FFFFFF;
scrollbar-track-color: #FFFFFF;
}
</style>

<script language="JavaScript">
<!--
   function enviar(opcao) {
      //OPÇÃO EXCLUIR SELECIONADA
   if(opcao == 'E') {
      document.forms[0].opc_excluir.value = 1;
   document.forms[0].submit();
      }//FECHA IF
   
   //OPÇÃO ATUALIZAR SELECIONADA
   if(opcao == 'A') {
      document.forms[0].opc_atualizar.value = 1;
   document.forms[0].submit();
      }//FECHA IF
   
   //OPÇÃO FINALIZAR SELECIONADA
   if(opcao == 'F') {
      document.forms[0].opc_finalizar.value = 1;
   document.forms[0].action = "finalizar.php";
   document.forms[0].submit();
      }//FECHA IF
   
   }//FECHA FUNCTION
//-->
</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#FFCC99">
<table width="773"  border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><br>
    <br>
    <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td align='center'><div align="left"><font face='Arial' size='4'><b>Carrinho 
              de Compras</b></font></div></td>
      </tr>
    </table>
    <br>
    <br>
    <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td><font size="2" face="Arial">Veja abaixo os produtos solicitados:</font></td>
      </tr>
    </table>
	
	<?
	//EXIBE O CARRINHO SE TIVER PRODUTOS
	if(count($_SESSION['cesta']) > 0) { ?>
	
    <form name="frmCarrinho" method="post">
    <input type="hidden" name="opc_excluir">
    <input type="hidden" name="opc_atualizar">
    <input type="hidden" name="opc_finalizar">
       <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr bgcolor="#CCCCCC">
          <td width="4%">&nbsp;</td>
          <td width="8%"><span class="style2">Qtde</span></td>
          <td width="51%"><span class="style2">Produto</span></td>
          <td width="19%"><span class="style2">Valor</span></td>
          <td width="18%"><span class="style2">Subtotal</span></td>
        </tr>
        <?
   //PEGA A CHAVE
      $chave_cesta  =  @array_keys($_SESSION['cesta']);
   
   //EXIBE OS PRODUTOS DA CESTA
   for($i=0; $i<sizeof('$chave_cesta'); $i++) { 
      $indice   =   $chave_cesta['$i']; 
   
   //SUBTOTAIS DE CADA PRODUTO
   $subtotal =   $_SESSION['cesta']['$indice']['QTDE'] * ereg_replace(",",".",$_SESSION['cesta']['$indice']['PRECO']);
   
   //TOTAL GERAL
   $total   +=   $subtotal;
   ?>
        <tr>
          <td height="25"><input name="check[]" type="checkbox" value="<? echo $indice; ?>"></td>
          <td height="25"><font face='Arial' size='2'>
    <input type="text" name="a_prod[<? echo "$indice"; ?>][QTDE]" value="<? echo $_SESSION[cesta][$indice][QTDE]; ?>" size="3"></font></td>
    <td height="25"><font face='Arial' size='2'><? echo $_SESSION['cesta']['$indice']['ARTISTA']; ?> - <? echo $_SESSION['cesta']['$indice']['ALBUM']; ?></font></td>
          <td height="25"><font face='Arial' size='2'>R$ <? echo $_SESSION['cesta']['$indice']['PRECO']; ?></font></td>
          <td width="18%" height="25"><font face='Arial' size='2'> R$ <? echo number_format($subtotal,2,',','.'); ?></font></td>
        </tr>
        <?
   }//FECHA FOR ?>
        <tr>
          <td height="25" colspan="3">
    <input type="image" name="btnExcluir" src="excluir.gif" onClick="enviar('E');">&nbsp;&nbsp;
    <input type="image" name="btnAtualiza" src="atualizar.gif" onClick="enviar('A');"></td>
          <td height="25" bgcolor="#FF0000"><span class="style5">&nbsp;&nbsp;Total &agrave; pagar: </span></td>
          <td height="25" bgcolor="#FFF0F0" class="style2"> &nbsp;&nbsp;R$&nbsp;<b><? echo number_format($total,2,',','.'); ?></b></td>
        </tr>
        <tr>
          <td height="25" colspan="3"><div align="center"><a class="link" href="../index.htm" target="_parent">Continuar 
                Compra</a></div></td>
          <td height="40" colspan="2"><div align="center">
    <input type="image" name="btnFinaliza" src="finaliza.gif" onClick="enviar('F');"></div></td>
          </tr>
      </table>
    </form>
	<?
	}//FECHA IF(count) 
	else { ?><br><br><br>
      <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align='center'><font face='Arial' size='2' color="#006666"><b>Desculpe, mas no momento você não possui nenhum produto.</b></td>
      </tr>
      </table><br><br>
	<?
	}//FECHA ELSE (count)?>
    <table width="70%"  border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td align='center'><font face='Arial' size='2'><a href="../index.htm">&lt;&lt; 
            Voltar </a></font></td>
      </tr>
    </table>
    <br>
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
</body>
</html>

Olha o erro que dá:
Notice: Undefined index: opc_atualizar in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 5

Notice: Undefined index: opc_excluir in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 25

Notice: Undefined variable: cesta in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 65

Tentei de tudo mais não funfou,como faz?
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#9 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 12/06/2004, 22:08

Ninguem sabe como solucionar? :wacko: :wacko: :wacko:
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#10 Felipe Pena

Felipe Pena

    O temor do Senhor é o princípio da sabedoria

  • Ex-Admins
  • 6441 posts
  • Sexo:Masculino

Posted 12/06/2004, 22:31

<?



session_start();



if($_POST['opc_atualizar']) {

  

  //RECEBE OS PRODUTOS CHECADOS PARA ATUALIZAÇÃO

  $v_atualiza  =  $_POST['a_prod'];

  

  //PEGA A CHAVE DO ARRAY

  $chave  =  array_keys($v_atualiza);

  

  //EXIBE

  for($i=0; $i<sizeof('$chave'); $i++) {

  //PEGA O INDICE DO PRODUTO

  $indice   =   $chave['$i'];

  

  //ALTERA A QUANTIDADE DO PRODUTO SELECIONADO

  $_SESSION['cesta']['$indice']['QTDE']   =  $v_atualiza['$indice']['QTDE'];

  }//FECHA FOR

}//FECHA IF





//VERIFICA SE A OPÇÃO EXCLUIR FOI SELECIONADA

elseif($_POST['opc_excluir']) {

  

  //RECEBE OS PRODUTOS CHECADOS PARA EXCLUSÃO

  $excluir  =  $_POST['check'];

  

  //EXIBE

  for($i=0; $i<sizeof('$excluir'); $i++) {

  //PEGA O INDICE DO PRODUTO

  $indice   =   $excluir['$i'];

  //DESTRÓI A VARIÁVEL ESPECIFICADA

  unset($_SESSION['cesta']['$indice']);

  }//FECHA FOR

}//FECHA IF







//RECEBE O PEDIDO DO USUÁRIO

elseif($_POST['opc_efetivar']) {

  //RECEBE AS VARIÁVEIS

  $v_prod  =  $_POST['txtprod'];

  

  //PEGA A CHAVE DO ARRAY

  $chave  =  array_keys($v_prod);



  //EXIBE

  for($i=0; $i<sizeof($chave); $i++) {

     $indice  =  $chave["$i"];

     

     //VERIFICA

     if(!empty($v_prod['$indice']['QTDE'])) {

     

     //GRAVA NO ARRAY CESTA

     $cesta[$indice][ARTISTA]  =    $v_prod[$indice][ARTISTA];

     $cesta[$indice][ALBUM]    =    $v_prod[$indice][ALBUM];

     $cesta[$indice][PRECO]    =    $v_prod[$indice][PRECO];

     $cesta[$indice][QTDE]     =    $v_prod[$indice][QTDE];

     }//FECHA IF

  }//FECHA FOR

  

  //GRAVA NA SESSÃO

  $_SESSION['cesta']        =   $cesta;

}//FECHA ELSE

//VERIFICA SE TEM PRODUTO NO CARRINHO PARA PUXAR

 if(count($_SESSION['cesta']) > 0) { 

   //PEGA A CHAVE DO ARRAY

   $chave = array_keys($_SESSION['cesta']);



  //PEGA OS DADOS DA SESSÃO

  for($i=0; $i<sizeof($chave); $i++) { 

    //ÍNDICE

    $indice = $chave['$i']; 



   //ATRIBUI

   $cesta['$indice']['ARTISTA'] = $_SESSION['cesta']['$indice']['ARTISTA'];

   $cesta['$indice']['ALBUM'] = $_SESSION['cesta']['$indice']['ALBUM'];

   $cesta[$indice]['PRECO'] = $_SESSION['cesta']['$indice']['PRECO'];

   $cesta[$indice]['QTDE'] = $_SESSION['cesta']['$indice']['QTDE'];

 }//FECHA FOR

}//FECHA IF



?>



<html>

<head>

<title>Carrinho</title>

<style type="text/css">

<!--

body {

margin-left: 0px;

margin-top: 0px;

margin-right: 0px;

margin-bottom: 0px;

}

.style2 {

color: #000000;

font-weight: bold;

}

.style5 {color: #FFFFFF; font-weight: bold; }

-->

<STYLE type="text/css">

<!--

BODY {

scrollbar-face-color: #000000;

scrollbar-highlight-color: #FFFFFF;

scrollbar-3dlight-color: #C0C0C0;

scrollbar-darkshadow-color: #404040;

scrollbar-shadow-color: #808080;

scrollbar-arrow-color: #FFFFFF;

scrollbar-track-color: #FFFFFF;

}

</style>



<script language="JavaScript">

<!--

  function enviar(opcao) {

     //OPÇÃO EXCLUIR SELECIONADA

  if(opcao == 'E') {

     document.forms[0].opc_excluir.value = 1;

  document.forms[0].submit();

     }//FECHA IF

  

  //OPÇÃO ATUALIZAR SELECIONADA

  if(opcao == 'A') {

     document.forms[0].opc_atualizar.value = 1;

  document.forms[0].submit();

     }//FECHA IF

  

  //OPÇÃO FINALIZAR SELECIONADA

  if(opcao == 'F') {

     document.forms[0].opc_finalizar.value = 1;

  document.forms[0].action = "finalizar.php";

  document.forms[0].submit();

     }//FECHA IF

  

  }//FECHA FUNCTION

//-->

</script>



<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>



<body bgcolor="#FFCC99">

<table width="773"  border="0" cellspacing="0" cellpadding="0">

   <tr>

   <td><br>

   <br>

   <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">

     <tr>

         <td align='center'><div align="left"><font face='Arial' size='4'><b>Carrinho 

             de Compras</b></font></div></td>

     </tr>

   </table>

   <br>

   <br>

   <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">

     <tr>

         <td><font size="2" face="Arial">Veja abaixo os produtos solicitados:</font></td>

     </tr>

   </table>



<?

//EXIBE O CARRINHO SE TIVER PRODUTOS

if(count($_SESSION['cesta']) > 0) { ?>



   <form name="frmCarrinho" method="post">

   <input type="hidden" name="opc_excluir">

   <input type="hidden" name="opc_atualizar">

   <input type="hidden" name="opc_finalizar">

      <table width="95%"  border="0" align="center" cellpadding="0" cellspacing="0">

       <tr bgcolor="#CCCCCC">

         <td width="4%">&nbsp;</td>

         <td width="8%"><span class="style2">Qtde</span></td>

         <td width="51%"><span class="style2">Produto</span></td>

         <td width="19%"><span class="style2">Valor</span></td>

         <td width="18%"><span class="style2">Subtotal</span></td>

       </tr>

       <?

  //PEGA A CHAVE

     $chave_cesta  =  @array_keys($_SESSION['cesta']);

  

  //EXIBE OS PRODUTOS DA CESTA

  for($i=0; $i<sizeof('$chave_cesta'); $i++) { 

     $indice   =   $chave_cesta['$i']; 

  

  //SUBTOTAIS DE CADA PRODUTO

  $subtotal =   $_SESSION['cesta']['$indice']['QTDE'] * ereg_replace(",",".",$_SESSION['cesta']['$indice']['PRECO']);

  

  //TOTAL GERAL

  $total   +=   $subtotal;

  ?>

       <tr>

         <td height="25"><input name="check[]" type="checkbox" value="<? echo $indice; ?>"></td>

         <td height="25"><font face='Arial' size='2'>

   <input type="text" name="a_prod[<? echo "$indice"; ?>][QTDE]" value="<? echo $_SESSION[cesta][$indice][QTDE]; ?>" size="3"></font></td>

   <td height="25"><font face='Arial' size='2'><? echo $_SESSION['cesta']['$indice']['ARTISTA']; ?> - <? echo $_SESSION['cesta']['$indice']['ALBUM']; ?></font></td>

         <td height="25"><font face='Arial' size='2'>R$ <? echo $_SESSION['cesta']['$indice']['PRECO']; ?></font></td>

         <td width="18%" height="25"><font face='Arial' size='2'> R$ <? echo number_format($subtotal,2,',','.'); ?></font></td>

       </tr>

       <?

  }//FECHA FOR ?>

       <tr>

         <td height="25" colspan="3">

   <input type="image" name="btnExcluir" src="excluir.gif" onClick="enviar('E');">&nbsp;&nbsp;

   <input type="image" name="btnAtualiza" src="atualizar.gif" onClick="enviar('A');"></td>

         <td height="25" bgcolor="#FF0000"><span class="style5">&nbsp;&nbsp;Total &agrave; pagar: </span></td>

         <td height="25" bgcolor="#FFF0F0" class="style2"> &nbsp;&nbsp;R$&nbsp;<b><? echo number_format($total,2,',','.'); ?></b></td>

       </tr>

       <tr>

         <td height="25" colspan="3"><div align="center"><a class="link" href="../index.htm" target="_parent">Continuar 

               Compra</a></div></td>

         <td height="40" colspan="2"><div align="center">

   <input type="image" name="btnFinaliza" src="finaliza.gif" onClick="enviar('F');"></div></td>

         </tr>

     </table>

   </form>

<?

}//FECHA IF(count) 

else { ?><br><br><br>

     <table width="90%"  border="0" align="center" cellpadding="0" cellspacing="0">

     <tr>

       <td align='center'><font face='Arial' size='2' color="#006666"><b>Desculpe, mas no momento você não possui nenhum produto.</b></td>

     </tr>

     </table><br><br>

<?

}//FECHA ELSE (count)?>

   <table width="70%"  border="0" align="center" cellpadding="0" cellspacing="0">

     <tr>

         <td align='center'><font face='Arial' size='2'><a href="../index.htm">&lt;&lt; 

           Voltar </a></font></td>

     </tr>

   </table>

   <br>

   </td>

 </tr>

 <tr>

   <td>&nbsp;</td>

 </tr>

</table>

</body>

</html>

Felipe Pena
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29

#11 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 12/06/2004, 22:45

Ainda deu este erro:
Notice: Undefined index: opc_atualizar in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 5

Notice: Undefined index: opc_excluir in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 25

Notice: Undefined variable: cesta in d:\corp\system\4tje8jiah9618604p2o7\web\vendas\carrinho.php on line 65

Alguem sabe como funcionar?
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!

#12 Felipe JS

Felipe JS

    The OC

  • Usuários
  • 167 posts
  • Sexo:Masculino

Posted 12/06/2004, 23:12

Coloque error_reporting(false); na primeira linha do código!

Edição feita por: Felipe JS, 12/06/2004, 23:12.

The OC Online
Katie Holmes

#13 Felipe Pena

Felipe Pena

    O temor do Senhor é o princípio da sabedoria

  • Ex-Admins
  • 6441 posts
  • Sexo:Masculino

Posted 12/06/2004, 23:24

Coloque error_reporting(false); na primeira linha do código!

O certo é error_reporting(0);
Pois o número será o nível.

Edição feita por: felipensp, 12/06/2004, 23:25.

Felipe Pena
[...] ó terra, terra, terra; ouve a palavra do Senhor. — Jeremias 22:29

#14 Troyan

Troyan

    12 Horas

  • Usuários
  • 285 posts
  • Sexo:Não informado
  • Localidade:Mesquita, Rio de Janeiro - Brasil
  • Interesses:Sou programador ASP, PHP, Javascript e ActionScript, além de ser curioso em JSP, ColdFusion e XSL. Trabalho com XML, XHTML, adoro webstandards e a W3C. Também trabalho com tableless e RIA's.<br><br> Formas de contato:<br> Email: dnunes[at]gmail[dot]com<br> ICQ: 68102402<br> MSN: troyandev@hotmail.com<br><br> -------------------------------------<br> - Rio de Janeiro, Brazil<br> - Troyan

Posted 13/06/2004, 02:46

Ignorar os erros não é exatamente uma solução...
~~ ~
diego nunes
web engineer

~ ~~

#15 Gui 1

Gui 1

    Normal

  • Usuários
  • 88 posts
  • Sexo:Não informado
  • Localidade:Araras/SP
  • Interesses:Linguagens de programação,METEORUS(jogo online),Mu Online,Ultima Online,informática em geral.

Posted 14/06/2004, 15:02

Por exemplo são d esuma importânica estas partes do arquivo
Ninguem sabe como soluciomnar sem ocultar erros?
Minhas previsões estavam certas!!!
Nem todas as pessoas,com seus acidos desoxibonucleicos conseguem aprender linguagens de programação!!!
Então você iniciante,não se receie, pergunte!!!




1 user(s) are reading this topic

0 membro(s), 1 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq