Jump to content
  • Revista PROGRAMAR: Já está disponível a edição #60 da revista programar. Faz já o download aqui!

Sign in to follow this  
tbesteves

Duvida na inserção de dados da combobox

Recommended Posts

tbesteves

Eu estou num trabalho de um stand online e quando pretendo registar um automovel eu escolho uma marca na combobox que vou buscar a uma tabela da base de dados. Queria saber como ao escolher uma marca ele envia-se o codigo para a tabela do carro e nao a marca pois esse campo apenas e para numeros o código é o seguinte:

<?php require_once('Connections/marca.php'); ?>
<?php
session_start();
if(isset($_SESSION['username'])){

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO carro (cod_marca, cod_modelo, cod_combustivel, cod_categoria, quilometros, portas, cod_caixa, cilindrada, primeiro_registo, preco, valor_negociavel) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['marca1'], "int"),
                       GetSQLValueString($_POST['modelo'], "int"),
                       GetSQLValueString($_POST['combustivel'], "int"),
                       GetSQLValueString($_POST['categoria'], "int"),
                       GetSQLValueString($_POST['km'], "int"),
                       GetSQLValueString($_POST['portas'], "int"),
                       GetSQLValueString($_POST['caixa'], "int"),
                       GetSQLValueString($_POST['cilindrada'], "int"),
                       GetSQLValueString($_POST['ano'], "int"),
                       GetSQLValueString($_POST['preco'], "int"),
                       GetSQLValueString($_POST['rb_preco'], "text"));

  mysql_select_db($database_marca, $marca);
  $Result1 = mysql_query($insertSQL, $marca) or die(mysql_error());

  $insertGoTo = "index.php?pag=pessoal";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_marca, $marca);
$query_categoria = "SELECT nome_categoria FROM categoria";
$categoria = mysql_query($query_categoria, $marca) or die(mysql_error());
$row_categoria = mysql_fetch_assoc($categoria);
$totalRows_categoria = mysql_num_rows($categoria);

mysql_select_db($database_marca, $marca);
$query_combustivel = "SELECT combustivel FROM combustivel";
$combustivel = mysql_query($query_combustivel, $marca) or die(mysql_error());
$row_combustivel = mysql_fetch_assoc($combustivel);
$totalRows_combustivel = mysql_num_rows($combustivel);

mysql_select_db($database_marca, $marca);
$query_portas = "SELECT portas FROM carro";
$portas = mysql_query($query_portas, $marca) or die(mysql_error());
$row_portas = mysql_fetch_assoc($portas);
$totalRows_portas = mysql_num_rows($portas);

mysql_select_db($database_marca, $marca);
$query_caixa = "SELECT tipo FROM tipo_de_caixa";
$caixa = mysql_query($query_caixa, $marca) or die(mysql_error());
$row_caixa = mysql_fetch_assoc($caixa);
$totalRows_caixa = mysql_num_rows($caixa);

mysql_select_db($database_marca, $marca);
$query_m = "SELECT marca FROM marca";
$m = mysql_query($query_m, $marca) or die(mysql_error());
$row_m = mysql_fetch_assoc($m);
$totalRows_m = mysql_num_rows($m);

mysql_select_db($database_marca, $marca);
$query_modelo = "SELECT modelo FROM modelo";
$modelo = mysql_query($query_modelo, $marca) or die(mysql_error());
$row_modelo = mysql_fetch_assoc($modelo);
$totalRows_modelo = mysql_num_rows($modelo);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationRadio.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.titulo {font-family: Arial, Helvetica, sans-serif;
color: #06F;
font-weight: bold;
font-size: 24px;
}
-->
</style>
<link href="SpryAssets/SpryValidationRadio.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="800" border="0">
  <tr>
    <td><form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
      <table width="800" border="0" align="center">
        <tr>
          <td colspan="4" align="center"> </td>
        </tr>
        <tr>
          <td colspan="4" align="center"><span class="titulo">Venda aqui a sua viatura</span></td>
          </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td width="199" align="left">Marca:<span id="spryselect1">
            <select name="marca1" id="marca1" title="<?php echo $row_m['marca']; ?>">
              <?php
do {  
?>
              <option value="<?php echo $row_m['marca']?>"<?php if (!(strcmp($row_m['marca'], $row_m['marca']))) {echo "selected=\"selected\"";} ?>><?php echo $row_m['marca']?></option>
              <?php
} while ($row_m = mysql_fetch_assoc($m));
  $rows = mysql_num_rows($m);
  if($rows > 0) {
      mysql_data_seek($m, 0);
  $row_m = mysql_fetch_assoc($m);
  }
?>
            </select>
            <span class="selectRequiredMsg">Por favor seleccione uma marca.</span></span></td>
          <td width="246">Modelo:<span id="sprytextfield6"><span id="spryselect3">
            <select name="modelo" id="modelo">
              <?php
do {  
?>
              <option value="<?php echo $row_modelo['modelo']?>"<?php if (!(strcmp($row_modelo['modelo'], $row_modelo['modelo']))) {echo "selected=\"selected\"";} ?>><?php echo $row_modelo['modelo']?></option>
              <?php
} while ($row_modelo = mysql_fetch_assoc($modelo));
  $rows = mysql_num_rows($modelo);
  if($rows > 0) {
      mysql_data_seek($modelo, 0);
  $row_modelo = mysql_fetch_assoc($modelo);
  }
?>
            </select>
            <span class="selectRequiredMsg">Por favor seleccione o modelo.</span></span><span class="textfieldRequiredMsg">Indique a marca1.</span></span></td>
          <td width="171"> </td>
          <td width="166"> </td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left">Categoria:<span id="spryselect4">
            <select name="categoria" id="categoria">
              <?php
do {  
?>
              <option value="<?php echo $row_categoria['nome_categoria']?>"<?php if (!(strcmp($row_categoria['nome_categoria'], $row_categoria['nome_categoria']))) {echo "selected=\"selected\"";} ?>><?php echo $row_categoria['nome_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>
            <span class="selectRequiredMsg">Por favor seleccione uma categoria.</span></span></td>
          <td>Quilómetros: <span id="sprytextfield3">
            <input type="text" name="km" id="km" />
            <span class="textfieldRequiredMsg">Indique os quilómetros.</span><span class="textfieldInvalidFormatMsg">Formato inválido.</span><span class="textfieldMaxCharsMsg">Excedeu o máximo de quilómetros possiveis.</span></span></td>
          <td>Combustivel:<span class="pesquisa-rapida">
            <select name="combustivel" id="combustivel" title="<?php echo $row_combustivel['combustivel']; ?>">
              <?php
do {  
?>
              <option value="<?php echo $row_combustivel['combustivel']?>"<?php if (!(strcmp($row_combustivel['combustivel'], $row_combustivel['combustivel']))) {echo "selected=\"selected\"";} ?>><?php echo $row_combustivel['combustivel']?></option>
              <?php
} while ($row_combustivel = mysql_fetch_assoc($combustivel));
  $rows = mysql_num_rows($combustivel);
  if($rows > 0) {
      mysql_data_seek($combustivel, 0);
  $row_combustivel = mysql_fetch_assoc($combustivel);
  }
?>
            </select>
          </span></td>
          <td>Número de portas:<span id="sprytextfield4">
            <input name="portas" type="text" id="portas" />
            <span class="textfieldRequiredMsg">Indique o número de portas.</span><span class="textfieldInvalidFormatMsg">Formato inválido.</span></span></td>
</tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left">Tipo de caixa:<span id="spryselect2">
            <select name="caixa" id="caixa" title="<?php echo $row_categoria['nome_categoria']; ?>">
              <?php
do {  
?>
              <option value="<?php echo $row_caixa['tipo']?>"<?php if (!(strcmp($row_caixa['tipo'], $row_caixa['tipo']))) {echo "selected=\"selected\"";} ?>><?php echo $row_caixa['tipo']?></option>
              <?php
} while ($row_caixa = mysql_fetch_assoc($caixa));
  $rows = mysql_num_rows($caixa);
  if($rows > 0) {
      mysql_data_seek($caixa, 0);
  $row_caixa = mysql_fetch_assoc($caixa);
  }
?>
            </select>
            <span class="selectRequiredMsg">Please select an item.</span></span></td>
          <td>Cilindrada:<span id="sprytextfield5">
          <input type="text" name="cilindrada" id="cilindrada" />
          <span class="textfieldRequiredMsg">Indique a cilindrada.</span><span class="textfieldInvalidFormatMsg">Formato inválido.</span></span></td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td height="51" align="left">Primeiro registo:<span id="sprytextfield2">
            <input type="text" name="ano" id="ano" />
            <span class="textfieldRequiredMsg">Indique o ano.</span><span class="textfieldInvalidFormatMsg">Formato inválido.</span><span class="textfieldMaxCharsMsg">Indique um ano entre 1900-2010.</span></span></td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr align="left">
          <td colspan="3">Fotos (A imagem não deve exceder os   4Mb e deve ser do tipo jpeg, png ou gif.) </td>
          <td><input type="submit" name="img" id="img" value="Carregar" /></td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left">Preço: <span id="sprytextfield1">
            <input name="preco" type="text" id="preco" maxlength="7" />
            <span class="textfieldRequiredMsg">Indique um preço.</span><span class="textfieldMaxCharsMsg">Excedeu o preço máximo possivel.</span><span class="textfieldInvalidFormatMsg">Formato inválido.</span></span></td>
          <td>€</td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left">Preço negociável:</td>
          <td><span id="spryradio1">
            <label>
              <input type="radio" name="rb_preco" value="Valor Fixo" id="rb_preco_0" />
              Valor Fixo</label>
            <br />
            <label>
              <input type="radio" name="rb_preco" value="Valor Negociável" id="rb_preco_1" />
              Valor Negociável</label>
            <br />
            <span class="radioRequiredMsg">Por favor seleccione uma opção.</span></span></td>
          <td> </td>
          <td align="center" valign="middle"><input type="submit" name="Seguinte" id="Seguinte" value="Seguinte" /></td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left"><input name="username" type="hidden" id="username" value="<?php $_SESSION['username'] ?>" /></td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        <tr>
          <td align="left"> </td>
          <td> </td>
          <td> </td>
          <td> </td>
        </tr>
        </table>
      <input type="hidden" name="MM_insert" value="form1" />
    </form></td>
  </tr>
</table>
<p> </p>
<script type="text/javascript">
<!--
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "integer", {maxChars:6});
var spryselect4 = new Spry.Widget.ValidationSelect("spryselect4");
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2");
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "integer", {maxChars:7});
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "integer", {maxChars:4});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "integer");
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var spryradio1 = new Spry.Widget.ValidationRadio("spryradio1");
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5", "integer");
var spryselect3 = new Spry.Widget.ValidationSelect("spryselect3");
//-->
</script>
</body>
</html>
<?php
mysql_free_result($categoria);

mysql_free_result($combustivel);

mysql_free_result($portas);

mysql_free_result($caixa);

mysql_free_result($m);

mysql_free_result($modelo);
				  }
				  else {
					  echo("Por favor primeiro faça login");
					echo "<tr>";
					echo "<td> <a href='index.php?pag=login'> <img src=\"images/login_v.gif\" alt=\"\" /></a></td>";
					echo "</tr>";

				  }
?>

Share this post


Link to post
Share on other sites
infopc

então tens uma tabela com esta estrutura

carros

id | marca (int(5)) |  ano (date) | maricula varchar(8)

_________________________________________

1 | 1                      | 2010          | 00-zz-00

e uma tabela de marcas

marca

id | nome

________

1  | Audi

quando geras as selects colocas no value o id da tabela marcas

<form method="post" action="grava_carro.php">
<input type="text" name="matricula" value="" />
<input type="text" name="ano" value="" />
<select name="marca">
<?php
$marcas = mysql_query("SELECT * FROM `marcas`;", $link);

while (($marca = mysql_fetch_assoc($marcas)) !== FALSE) :
?>
     <option value="<?php echo $marca["id"]?>"><?php echo $marca["nome"]?></option>
<?php
endwhile;
?>
</select>
<input type="submit" value="gravar" />
</form>

no ficheiro grava_carro.php no array $_POST vais ter o id da marca e não o nome depois é so gravar

Fica bem


O que não tem solução, solucionado esta...

Share this post


Link to post
Share on other sites
tbesteves

Agradeço a sua ajuda consegui resolver muito obrigado

Ja agora como consigo fazer umas pesquisa atraves de combobox e devolver noutra pagina?

o meu código é o seguinte mas apenas lista todas

<?php require_once('Connections/marca.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_marca, $marca);
$query_pesq = "SELECT marca FROM marca";
$pesq = mysql_query($query_pesq, $marca) or die(mysql_error());
$row_pesq = mysql_fetch_assoc($pesq);
$totalRows_pesq = mysql_num_rows($pesq);

mysql_select_db($database_marca, $marca);
$query_modelo = "SELECT modelo FROM modelo  INNER JOIN marca_modelo  ON modelo.cod_modelo=marca_modelo.cod_marca";
$modelo = mysql_query($query_modelo, $marca) or die(mysql_error());
$row_modelo = mysql_fetch_assoc($modelo);
$totalRows_modelo = mysql_num_rows($modelo);

mysql_select_db($database_marca, $marca);
$query_combustivel = "SELECT combustivel FROM combustivel";
$combustivel = mysql_query($query_combustivel, $marca) or die(mysql_error());
$row_combustivel = mysql_fetch_assoc($combustivel);
$totalRows_combustivel = mysql_num_rows($combustivel);

mysql_select_db($database_marca, $marca);
$query_min = "SELECT preco FROM carro ORDER BY preco DESC";
$min = mysql_query($query_min, $marca) or die(mysql_error());
$row_min = mysql_fetch_assoc($min);
$totalRows_min = mysql_num_rows($min);

mysql_select_db($database_marca, $marca);
$query_max = "SELECT preco FROM carro ORDER BY preco ASC";
$max = mysql_query($query_max, $marca) or die(mysql_error());
$row_max = mysql_fetch_assoc($max);
$totalRows_max = mysql_num_rows($max);
?>
<style type="text/css">
<!--
#apDiv4 {	position:absolute;
left:299px;
top:596px;
width:72px;
height:25px;
z-index:1;
visibility: visible;
}
.pesquisa {
font-family: Arial, Helvetica, sans-serif;
font-size: 18px;
}
.pesq {
font-size: 18px;
}
#apDiv1 {
position:absolute;
left:243px;
top:691px;
width:59px;
height:25px;
z-index:1;
}
-->
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<div id="apDiv1">
  <form action="index.php?pag=resultados" method="post" name="form1" id="form1">
    <input type="submit" name="pesquisar" id="pesquisar" value="Pesquisar" />
  </form>
</div>
<p> </p>

<table width="800" border="0">
  <tr>
    <td height="844"><form id="form2" name="form2" method="get" action="index.php?pag=resultados">
      <table width="800" border="0">
        <tr align="left" valign="top">
          <th height="836"><p class="pesq">Pesquise a sua próxima viatura entre as mais diversas existentes. </p>
            <p class="pesq">Você indica o que pretende nós fazemos o resto.</p>
            <p class="pesq"> </p>
            <p class="pesq"><span class="pesquisa">Pesquisa Rápida </span></p>
            <table width="59%" height="546" border="0" align="right" id="destaques2">
              <tr>
                <td height="229" colspan="3" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="418" height="228" id="FlashID" title="ferrari">
                  <param name="movie" value="Videos/ferrari.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/ferrari.swf" width="418" height="228">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                </tr>
              <tr>
                <td height="29" colspan="3" align="center"><span class="pesq">Ferrari</span></td>
                </tr>
              <tr>
                <td width="34%" height="102" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID2" title="opel">
                  <param name="movie" value="Videos/opel.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/opel.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                <td width="33%" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID3" title="audi">
                  <param name="movie" value="Videos/audi.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/audi.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                <td width="33%" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID4" title="alfa">
                  <param name="movie" value="Videos/alfa.swf" />
                  <param name="quality" value="high" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/alfa.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                </tr>
              <tr>
                <td height="33" align="center"><span class="pesq">Opel corsa</span></td>
                <td align="center"><span class="pesq">Audi A6</span></td>
                <td align="center"><span class="pesq">Alfa Romeu</span></td>
                </tr>
              <tr>
                <td height="102" align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID5" title="toyota">
                  <param name="movie" value="Videos/toyota.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/toyota.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                <td align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID6" title="nissan">
                  <param name="movie" value="Videos/nissan.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/nissan.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                <td align="center"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="136" height="96" id="FlashID7" title="mini">
                  <param name="movie" value="Videos/mini.swf" />
                  <param name="quality" value="high" />
                  <param name="wmode" value="transparent" />
                  <param name="swfversion" value="6.0.65.0" />
                  <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
                  <param name="expressinstall" value="Scripts/expressInstall.swf" />
                  <param name="SCALE" value="exactfit" />
                  <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
                  <!--[if !IE]>-->
                  <object type="application/x-shockwave-flash" data="Videos/mini.swf" width="136" height="96">
                    <!--<![endif]-->
                    <param name="quality" value="high" />
                    <param name="wmode" value="transparent" />
                    <param name="swfversion" value="6.0.65.0" />
                    <param name="expressinstall" value="Scripts/expressInstall.swf" />
                    <param name="SCALE" value="exactfit" />
                    <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
                    <div>
                      <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
                      <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
                      </div>
                    <!--[if !IE]>-->
                    </object>
                  <!--<![endif]-->
                  </object></td>
                </tr>
              <tr>
                <td height="37" align="center"><span class="pesq">Toyota Corolla</span></td>
                <td align="center"><span class="pesq">Nissan Patrol</span></td>
                <td align="center"><span class="pesq">Mini One</span></td>
                </tr>
              <tr> </tr>
              <tr> </tr>
              <tr> </tr>
              <tr> </tr>
              <tr> </tr>
              <tr> </tr>
              </table>
            <p>Marca <span class="pesquisa-rapida">
              <select name="marca" id="marca">
                <?php
do {  
?>
                <option value="<?php echo $row_pesq['marca']?>"<?php if (!(strcmp($row_pesq['marca'], $row_pesq['marca']))) {echo "selected=\"selected\"";} ?>><?php echo $row_pesq['marca']?></option>
                <?php
} while ($row_pesq = mysql_fetch_assoc($pesq));
  $rows = mysql_num_rows($pesq);
  if($rows > 0) {
      mysql_data_seek($pesq, 0);
  $row_pesq = mysql_fetch_assoc($pesq);
  }
?>
              </select>
              </span></p>
            <p>Modelo<span class="pesquisa-rapida">
              <select name="modelo" id="modelo">
                <?php
do {  
?>
                <option value="<?php echo $row_modelo['modelo']?>"<?php if (!(strcmp($row_modelo['modelo'], $row_modelo['modelo']))) {echo "selected=\"selected\"";} ?>><?php echo $row_modelo['modelo']?></option>
                <?php
} while ($row_modelo = mysql_fetch_assoc($modelo));
  $rows = mysql_num_rows($modelo);
  if($rows > 0) {
      mysql_data_seek($modelo, 0);
  $row_modelo = mysql_fetch_assoc($modelo);
  }
?>
              </select>
              </span></p>
            <p>Combustível<span class="pesquisa-rapida">
              <select name="combustivel" id="combustivel">
                <?php
do {  
?>
                <option value="<?php echo $row_combustivel['combustivel']?>"<?php if (!(strcmp($row_combustivel['combustivel'], $row_combustivel['combustivel']))) {echo "selected=\"selected\"";} ?>><?php echo $row_combustivel['combustivel']?></option>
                <?php
} while ($row_combustivel = mysql_fetch_assoc($combustivel));
  $rows = mysql_num_rows($combustivel);
  if($rows > 0) {
      mysql_data_seek($combustivel, 0);
  $row_combustivel = mysql_fetch_assoc($combustivel);
  }
?>
              </select>
              </span></p>
            <p>Preço de <span id="spryselect1">
              <select name="min" id="min">
                <?php
do {  
?>
                <option value="<?php echo $row_min['preco']?>"<?php if (!(strcmp($row_min['preco'], $row_min['preco']))) {echo "selected=\"selected\"";} ?>><?php echo $row_min['preco']?></option>
                <?php
} while ($row_min = mysql_fetch_assoc($min));
  $rows = mysql_num_rows($min);
  if($rows > 0) {
      mysql_data_seek($min, 0);
  $row_min = mysql_fetch_assoc($min);
  }
?>
              </select>
              <span class="selectRequiredMsg">Please select an item.</span></span> a <span id="spryselect2">
                <select name="max" id="max">
                  <?php
do {  
?>
                  <option value="<?php echo $row_max['preco']?>"<?php if (!(strcmp($row_max['preco'], $row_max['preco']))) {echo "selected=\"selected\"";} ?>><?php echo $row_max['preco']?></option>
                  <?php
} while ($row_max = mysql_fetch_assoc($max));
  $rows = mysql_num_rows($max);
  if($rows > 0) {
      mysql_data_seek($max, 0);
  $row_max = mysql_fetch_assoc($max);
  }
?>
                </select>
              <span class="selectRequiredMsg">Please select an item.</span></span></p>
            <p> </p>
            <p><a href="index.php?pag=pesquisar">Pesquisa Avançada</a></p></th>
</tr>
        </table>
    </form></td>
  </tr>
</table>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID4");
swfobject.registerObject("FlashID3");
swfobject.registerObject("FlashID2");
swfobject.registerObject("FlashID");
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2");
swfobject.registerObject("FlashID7");
swfobject.registerObject("FlashID5");
swfobject.registerObject("FlashID6");
//-->
</script>
<?php
mysql_free_result($pesq);

mysql_free_result($modelo);

mysql_free_result($combustivel);

mysql_free_result($min);

mysql_free_result($max);
?>
<?php

?>

Cumprimentos

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.