Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP / Select

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0

I am displaying all sql records.
I have new_customer.asp file and edit_customer.asp
If user checks I want to send the user to edit_customer.asp,
if he submits without checking,
I want send user to add_customer.asp.
I coded like below. I am submitting page it self.

Some bugs are there. Help me with code. Thank you.
***************************************************
<!-- file name - submitHere.asp&quot; -->
<%
set conn=Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.open &quot;dsn=northwind&quot;
set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
sql = &quot;Select * from CUSTOMERS where country = 'USA' order by CUSTOMERID&quot;
rs.Open sql, conn
%>

<%
Do Until rs.EOF %>
<form action=&quot;submitHere.asp&quot; method=&quot;post&quot;>
<table border=&quot;1&quot; cellpadding=0&quot; cellspacing=&quot;0&quot;>
<tr>
<td width=&quot;30&quot; align=&quot;center&quot;><input type=&quot;radio&quot; name=&quot;radioSelect&quot; value='&quot;<%= rs(&quot;CustomerID&quot;) %>&quot;'></td>
<td width=&quot;300&quot;><%= rs(&quot;CompanyName&quot;) %></td>
</tr>
</table>
<%
rs.movenext
Loop
%>
<table>
<tr>
<td><input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;submit&quot;></td>
<td><input type=&quot;reset&quot; name=&quot;reset&quot; value=&quot;reset&quot;></td>
</tr>
</table>
</form>
<%
Dim gotoSelection
gotoSelection = Request.form(&quot;radioSelect&quot;)

If gotoSelection = &quot;1&quot; Then
' If value is selected edit existing customer
Response.redirect &quot;GOTO_EDITP.ASP&quot;
Elseif gotoSelection = &quot;0&quot; Then
' If value is not checked go to add new a customer
Response.redirect &quot;GOTO_ADD_NEW.ASP&quot;
End if
%>
</body>
</html>
******************************************
 
ok for starters, if you are trying to populate a select statement with results, this is how it should be

<form action=&quot;submitHere.asp&quot; method=&quot;post&quot;>
<table border=&quot;1&quot; cellpadding=0&quot; cellspacing=&quot;0&quot;>
<% Do Until rs.EOF %>
<tr>
<td width=&quot;30&quot; align=&quot;center&quot;><input type=&quot;radio&quot; name=&quot;radioSelect&quot; value='&quot;<%= rs(&quot;CustomerID&quot;) %>&quot;'></td>
<td width=&quot;300&quot;><%= rs(&quot;CompanyName&quot;) %></td>
</tr>
<%
rs.movenext
Loop
%>
</table>
<%
rs.movenext
Loop
%>
<table>
<tr>
<td><input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;submit&quot;></td>
<td><input type=&quot;reset&quot; name=&quot;reset&quot; value=&quot;reset&quot;></td>
</tr>
</table>
</form>


Secondly

the following is missing &quot;

<!-- file name - submitHere.asp&quot; -->

hope that helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top