PDA

View Full Version : Really Simple Yet Wont Work!



thedaveyb
February 8th, 2007, 11:06 AM
hey people... am really struggling with this as seems straightforward yet wont work...

its basically a form, that submits to the same page.

there is then an IF statement requesting the Form value and then will either do option one or option two from there.


<%

applicant_treatment = request.Form("applicant_treatment")

%>

<form action="eshot.asp" method="post" name="home_news" id="home_news">
<select class="login" style="width: 250px;" name="applicant_treatment" id="applicant_treatment" onchange="document.home_news.submit()" >
<option value="na">Please Select </option>
<%
sql = "Select applicant_treatment from applicants"
rs.open sql,,,adopenstatic
do while not rs.eof
%>
<option <% if applicant_treatment = rs("applicant_treatment") then response.Write("selected") end if %> value="<%=rs("applicant_treatment") %>"><%=rs("applicant_treatment") %></option>
<%
rs.movenext
loop
rs.close
%>
</select>

<input class="sub" type="submit" value="View News Article"/>

</form>




<h1> <em>Send</em> Eshot </h1>



<div id="task_select">
<%
if applicant_treatment <> "" Then
sql = "Select * from applicants where applicant_treatment = " & applicant_treatment
else
sql = "Select * from applicants"
End if
rs.open sql, , , adopenstatic
%>


<%
response.Write("<textarea cols='50' rows='15' name='recipient' id='recipient'>")
%>
<%
do while not rs.eof
response.Write (rs("applicant_email") & ";")
rs.movenext
loop
rs.close
%>
<%
response.Write("</textarea> ")
%>
</div>


im basically getting the result

No value given for one or more required parameters.
/cms/eshot.asp, line 54


*applicant treatment is the field from the database and is in text format.

nobody
February 9th, 2007, 02:40 PM
I don't know ASP, which is what I'm guessing that is, but the error looks like you're not passing all the required arguments for a particular function. Double check all your functions for required arguments.

Digitalosophy
February 9th, 2007, 02:56 PM
Whats with rs.open sql, , , adopenstatic?

Why all the commas?

borrob
February 9th, 2007, 04:47 PM
first this
if applicant_treatment = rs("applicant_treatment") then
shouldn't this be == ??

Sorry but asp is a long time ago with me
and then

sql = "Select * from applicants where applicant_treatment
= " & applicant_treatment

if applicant_treatment is a string as i suspect because off

if applicant_treatment <> "" Then

shouldn't this be enclosed in single quotes?
like:

sql = "Select * from applicants where applicant_treatment
= '" & applicant_treatment & "'"

i hope it helps