Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Fe_meneguette

[Resolvido] Erros PHP

Recommended Posts

Ola galera da imasters!! Estou tendo uns probleminhas com o PHP e gostaria de ver se alguem ai consegue me ajudar, o codigo está em PHP4 e estou passando para o php5. La vão as bombas :pinch:

 

PAGINA ADICIONAR_VEICULOS.PHP

 

ERROS:

 

 

Notice: Undefined variable: erro in C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php on line 381

>

<br /><b>Notice</b>: Undefined index: ano1 in <b>C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php</b> on line <b>439</b><br />

<br /><b>Notice</b>: Undefined index: ano2 in <b>C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php</b> on line <b>443</b><br />

<br /><b>Notice</b>: Undefined index: preco in <b>C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php</b> on line <b>467</b><br />

<br /><b>Notice</b>: Undefined offset: 4 in <b>C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php</b> on line <b>473</b><br />

<br /><b>Notice</b>: Undefined index: km in <b>C:\xampp\htdocs\helio multimarcas\adicionar_veiculos.php</b> on line <b>490</b><br />

 

 

CODIGO:

 

<body <?php if ($erro == 1) { echo 'onload="ErroCodigo();"';} ?>>
<div id="layout">
 <div id="layout_principal">
  	<div id="topo<?php if ($_SESSION['Status'] == "repasses") { echo "2"; } ?>">
  	  <div id="topo_logo"><a href="index.php"><img src="images/logo.gif" /></a></div>
		<?php if ($_SESSION['Status'] <> "repasses") { include("inc_login".".php"); } else { include("inc_login2".".php"); } ?>
       <div id="menu">
		<?php include("inc_menu.php"); ?>
       </div>
       </div>
       <div id="centro">
       	<div id="texto">
           	<div id="titulo">
               <table><tr><td><?php echo $row_conteudo['titulo']; ?></td></tr></table></div>
               <span><?php echo $row_conteudo['texto']; ?></span>
       	</div>
           <div id="texto2">     
           <img src="images/planos/<?php echo $row_planos['imagem']; ?>" /><Br /><Br />
             <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="add" id="add" onsubmit="return AdicionarCarros();">
               <table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
   <td width="50%"><table>
<tr>
 <td height="20" class="vermelho_11px_upper"><strong>PLANO: </strong></td>
 <td height="20"><strong><?php echo $row_planos['nome']; ?></strong></td>
</tr>
<tr>
 <td height="20" class="vermelho_11px_upper"><strong>CATEGORIA *</strong></td>
 <td height="20"><select name="id_categoria" id="id_categoria" style="width:130px;"  onchange="javascript:Carrega5('ajax_marcas.php',this.value);">
   <option value="">escolha uma opção</option>
   <?php
do {  
?>
   <option value="<?php echo $row_categoria['id']?>"><?php echo $row_categoria['categoria']?></option>
   <?php
} while ($row_categoria = mysql_fetch_assoc($categoria));
 $rows = mysql_num_rows($categoria);
 if($rows > 0) {
     mysql_data_seek($categoria, 0);
  $row_categoria = mysql_fetch_assoc($categoria);
 }
?>
 </select>  </td>
</tr>
<tr>
 <td height="20" class="vermelho_11px_upper"><strong>MARCA *</strong></td>
 <td width="225" height="20"><div id="marca">
                   <select name="id_modelo" id="id_modelo" disabled="disabled" style="width:130px;">
                       <option value="0">escolha uma opção</option>
                   </select>
               </div></td>
</tr>
<tr>
 <td height="20" class="vermelho_11px_upper"><strong>MODELO *</strong></td>
 <td height="20"><div id="modelo"><select name="id_modelo" id="id_modelo" disabled="disabled" style="width:130px;"><option value="">escolha uma opção</option></select></div></td>
</tr>
                   <tr>
                     <td width="113" height="20" class="vermelho_11px_upper"><strong>ANO  1*</strong></td>
                     <td height="20"><input name="ano1" type="text" class="input" id="ano1" value="<?php echo $_POST['ano1']; ?>" size="5" maxlength="4" /></td>
                 </tr>
                   <tr>
                     <td height="20" class="vermelho_11px_upper"><strong>ANO 2 *</strong></td>
                     <td height="20"><input name="ano2" type="text" class="input" id="ano2" value="<?php echo $_POST['ano2']; ?>" size="5" maxlength="4" /></td>
                   </tr>
                   <tr>
                     <td width="113" height="20" class="vermelho_11px_upper"><strong>COR *</strong></td>
                     <td height="20"><span id="cb_telefone">
                     <select name="cor" id="cor" style="width:130px;"><option value="">escolha uma opção</option>
                       <?php
do {  
?>
                       <option value="<?php echo $row_cor['cor']?>"><?php echo $row_cor['cor']?></option>
                       <?php
} while ($row_cor = mysql_fetch_assoc($cor));
 $rows = mysql_num_rows($cor);
 if($rows > 0) {
     mysql_data_seek($cor, 0);
  $row_cor = mysql_fetch_assoc($cor);
 }
?>
                     </select>
                     </span></td>
                   </tr>
                   <tr>
                     <td width="113" height="20" class="vermelho_11px_upper"><strong>PREÇO *</strong></td>
                     <td height="20"><span id="cb_email">
                     <input name="preco" type="text" class="input" id="preco" value="<?php echo $_POST['preco']; ?>" size="10" maxlength="10"/>
                     Ex. 19.000,00</span></td>
                   </tr>
                   <tr>
                     <td height="20" class="vermelho_11px_upper"><strong>PORTAS</strong></td>
                   <td height="20"><span id="cb_telefone2">
                       <input name="portas" type="text" class="input" id="portas" value="<?php echo $_POST['4']; ?>" size="5" maxlength="1" />
                     </span></td>
                   </tr>
                   <tr>
                     <td height="20" class="vermelho_11px_upper"><strong>CONDIÇÕES *</strong></td>
                     <td height="20"><label>
                       <select name="condicoes" id="condicoes" style="margin-right:10px; width:130px;">
                         <option value="0">escolha uma opção</option>
                         <option value="Novo">Novo</option>
                         <option value="Usado">Usado</option>
                         <option value="Financiado">Financiado</option>
                     </select>
                     </label></td>
                   </tr>
                   <tr>
                     <td height="20" class="vermelho_11px_upper"><strong>KM *</strong></td>
                     <td height="20"><span id="cb_email4">
                       <input name="km" type="text" class="input" id="km" value="<?php echo $_POST['km']; ?>" size="10" maxlength="10"/>
                     Ex. 80.000</span></td>
                 </tr>
                   <tr>
                     <td height="20" class="vermelho_11px_upper"><strong>COMBUSTÍVEL *</strong></td>
                     <td height="20"><label>
                       <select name="combustivel" id="combustivel" style="margin-right:10px; width:130px;">
                         <option>escolha uma opção</option>
                         <option value="Gasolina">Gasolina</option>
                         <option value="Alcool">Álcool</option>
                         <option value="Diesel">Diesel</option>

 

 

 

 

 

 

 

Coloquei o codigo da linha 381 - 500, se precisar disponibilizo o codigo para download.

 

Abraços!!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Eesse tipo de erro existia mesmo na versão 4. A diferença é que no 5 o warning e ativado por padrão.

 

 

Para corrigir, comece configurando o seu ambiente:

http://forum.imasters.com.br/topic/447379-configuracao-de-log-e-eventos-de-erros-do-php/

 

 

Os erros no seu caso ocorrem devido inexistência de índices do array..

para evitar esses erros, utilize isset()

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.