Ir para conteúdo
Fórum Script Brasil
  • 0

Select Automatico..


--Ludson--

Pergunta

beleza galera??

tipo..

sabem quando tem algum cadastro e você tem que selecionar uma opção num select..

ai quando você seleciona, o segundo select te da mais opções...

complicou??

huehueuhe..

assim...

é atualizar lista dinamica...

tenho 2 selects...

1º:

1 - Fiat

2 - Volks

3 - Ford

2º:

- Stilo

- Palio

- Siena

- Gol

- Bora

- Golf

- KA

- Focus

- Ranger

ai tipo..

quando eu seleciono uma opção no primeiro, o segundo select se restringe a opção..

tipo.. se eu selecionar no primeiro select a opção "Fiat" o segundo select só iria me mostrar os carros da fiat..

tenderam??

alguém ai poderia me ajudar por favor????

vlewws

blink.gifph34r.gif

Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0

Ludson,

Eu tenho aqui um sistema de DDD...ele faz o seguinte:

digito qual UF desejo e ele me mostra todas as cidades só dakela UF...ex.:

Digito MG...então ele me mostra só as cidades de Minas

Acho que é isso que você quer não é??? No caso basta você mudar a questão de digitar para um campo select.

Se for isso mesmo, me fale q te mando o sistema e você pode dar uma olhada.

Mateus

Link para o comentário
Compartilhar em outros sites

  • 0

cara tentei mandar o email de novo e retornou...estranho..

mas vou postar o código aqui:

ddd.asp

<%
' Declare our variables... always good practice!
Dim strURL     ' The URL of this page so the form will work
               ' no matter what this file is named.

Dim cnnSearch  ' ADO connection
Dim rstSearch  ' ADO recordset
Dim strDBPath  ' path to our Access database (*.mdb) file

Dim strSQL     ' The SQL Query we build on the fly
Dim strSearch  ' The text being looked for


'#Função que tira todos os acentos das palavras
function TiraAcento(StrAcento)
 for i = 1 to len(StrAcento) 
  Letra = mid(StrAcento, i, 1)
  Select Case Letra
   Case "á","Á","à","À","ã","Ã","â","Â","â","ä","Ä"
   Letra = "A"
   Case "é","É","ê","Ê","Ë","ë","È","è"
   Letra = "E"
   Case "í","Í","ï","Ï","Ì","ì"
   Letra = "I"
   Case "ó","Ó","ô","Ô","õ","Õ","ö","Ö","ò","Ò"
   Letra = "O"
   Case "ú","Ú","Ù","ù","ú","û","ü","Ü","Û"
   Letra = "U"
   Case "ç","Ç"
   Letra = "C"
   Case "não"
   Letra = "N"
  End Select
  texto = texto & Letra
 next
 TiraAcento = texto
end function 

' Retreive the URL of this page from Server Variables
strURL = Request.ServerVariables("URL")

' Retreive the term being searched for.  I'm doing it on
' the QS since that allows people to bookmark results.
' You could just as easily have used the form collection.
strSearch = Request.QueryString("search")

' Since I'm doing this all in one page I need to see if anyone
' has searched for something.  If they have we hit the DB.
' O/W I just show the search form and quit.

%>
<p>&nbsp;</p><table width="30%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#F5F5FA">
<tr>
    <td><p align="center"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: 
        Digite o nome da cidade para exibi&ccedil;&atilde;o do seu respectivo 
        DDD :</font>:</STRONG></FONT></p>
      <form action="<%= strURL %>" method="get">
        <div align="center">
          <input name="search" value="<%= strSearch %>" />
          <input name="submit" type="submit" value="Pesquisar" />
        </div>
      </form>
      <p align="center"> 
        <%
If strSearch <> "" Then
	' MapPath of virtual database file path to a physical path.
	' If you want you could hard code a physical path here.
	strDBPath = Server.MapPath("ddd.mdb")


	' Create an ADO Connection to connect to the sample database.
	' We're using OLE DB but you could just as easily use ODBC or a DSN.
	Set cnnSearch = Server.CreateObject("ADODB.Connection")

	' This line is for the Access sample database:
	cnnSearch.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

	' We're actually using SQL Server so we use this line instead:
	'cnnSearch.Open Application("SQLConnString")

	' Build our query based on the input.

	strSQL = "SELECT Cidade, UF, DDD " _
  & "FROM DDD " _
  & "WHERE Cidade LIKE '%" & TiraAcento(Replace(strSearch, "'", "''")) & "%' " _
  & "OR UF LIKE '%" & TiraAcento(Replace(strSearch, "'", "''")) & "%' " _
  & "ORDER BY Cidade;"

	' Execute our query using the connection object.  It automatically
	' creates and returns a recordset which we store in our variable.
	Set rstSearch = cnnSearch.Execute(strSQL)

	' Display a table of the data in the recordset.  We loop through the
	' recordset displaying the fields from the table and using MoveNext
	' to increment to the next record.  We stop when we reach EOF.
	' For fun I'm combining some fields and showwing you can do more then
	' just spit out the data in the form it is in in the table.
	%>
      </p>
      <div align="center">
        <table border="0" cellpadding="4" cellspacing="1">
          <tr> 
            <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: 
              Cidade :</font>:</STRONG></FONT></th>
            <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: 
              DDD:</font>:</STRONG></FONT></th>
            <th bgcolor="#6699CC"><FONT color=royalblue face=Tahoma size=2><STRONG><font color="#000033">:: 
              UF :</font>:</STRONG></FONT></th>
          </tr>
          <%
	Do While Not rstSearch.EOF
  %>
          <tr> 
            <td bgcolor="#D7F2FF"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("Cidade").Value %></font></td>
            <td bgcolor="#D7F2FF"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("DDD").Value %></font></div></td>
            <td bgcolor="#D7F2FF"><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><%= rstSearch.Fields("UF").Value %></font></div></td>
          </tr>
          <%

  rstSearch.MoveNext
	Loop
	%>
        </table>
        <%
	' Close our recordset and connection and dispose of the objects
	rstSearch.Close
	Set rstSearch = Nothing
	cnnSearch.Close
	Set cnnSearch = Nothing
End If

' That's all folks!  See it's really not all that hard.
%>
      </div></td>
  </tr>
</table>
<p>&nbsp;</p>

No bd você cria a tabela ddd com os campos: id, cidade, uf e ddd

ele vai pegar o uf q você escolher e mostrar todas as cidades referentes.

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...