Current location: Hot Scripts Forums » Programming Languages » ASP » Help me to Show the output below the form


Help me to Show the output below the form

Reply
  #1 (permalink)  
Old 12-21-05, 10:08 AM
dev.amit dev.amit is offline
New Member
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Help me to Show the output below the form

Dear Friends
Hi
I am new to this forum...
But with a problem...
I am unable to show the output of a seach below the form.
I have made two pages One for the form and another for the Qeary and output and connected but unable to show the output below d form..

I am writing the code below

Form page:

<html>
<body>
<table align="center" height="50%" cellspacing="2%">
<tr ><td colspan=3 align="center"><h3><u>CONTACT</u></h3></td></tr>

<form method="post" action="process.asp">

<tr><td>CompanyName</td><td><input type="text" name="Companyname"></td></tr>

<tr><td>ContactName</td><td><input type="text" name="Contactname"></td></tr>

<tr><td>Country</td><td><input type="text" name="country"></td></tr>

<tr><td colspan=3 align="center"><input type="submit" value="Search"></td></tr>


</table>
</form>
</body>
</html>


Asp page:

<%
company=Request.Form("companyname")
contact=Request.Form("contactname")
countri=Request.Form("country")

cheak=company+contact+countri
Blank=""
If cheak = Blank Then
Response.Write("All the fields are Blank")

Else

%>
<html>
<body>
<%
set conn=Server.CreateObject("ADODB.Connection")
conn.provider="Microsoft.jet.OLEDB.4.0"
conn.open "c:/amit/database/northwind.mdb"
set rs=Server.CreateObject("ADODB.recordset")

If company+contact="" Then
sql="SELECT Companyname, Contactname, Country FROM Customers WHERE country LIKE '"&countri&"'"
Else
sql="SELECT Companyname, Contactname, Country FROM Customers WHERE (companyname LIKE '"&company&"' OR contactname LIKE '"&contact&"')"
End IF

rs.open sql,conn
%>
<table border="1" width="100%" valign="bottom" cellpadding="0" Cellspacing="5" bgcolor="#boc4de">
<tr align="left" bgcolor="7fff00">
<%For Each x in rs.fields%>
<td><%Response.Write(X.name)%></td>
<%Next%>
</tr>
<%
I=1
Do until rs.EOF

a=I mod 2
If a=0 Then

%>
<tr align="left" bgcolor="00ffff">
<%for each x in rs.fields%>
<td><% Response.Write(X.value)%></td>
<%Next%>
</tr>
<%Else%>

<tr align="left" bgcolor="ffff00">
<%for each x in rs.fields%>
<td><% Response.Write(X.value)%></td>
<%Next%>
</tr>
<%
End If
I=I+1
rs.MoveNext
Loop
rs.close
conn.close
set rs=nothing
set conn=nothing
%>
</table>
</body>
</html>
<%End if%>

If anyone can help me i would be greatful to him/her.
Waiting for ur reply
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-21-05, 11:14 AM
koncept
Guest
 
Posts: n/a
<form action="?action=search" method="post">
your form here

<% if request.querysting("action") = "search" then%>
all your query and out put code here
<% end if %>

edit: its psedo code, the asp is correct though.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
Formatting form output Julio HTML/XHTML/XML 0 01-07-05 11:33 AM
Passing form output more than 1 script iwpg Perl 5 09-07-04 05:46 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
Classified Ads skipper23 Perl 2 12-30-03 04:43 AM


All times are GMT -5. The time now is 07:06 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.