Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - If problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

If problem

 Post Reply Post Reply
Author
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Topic: If problem
    Posted: 15 March 2005 at 6:21pm

I've been having trouble with getting an if statement to work. What I want to do is if one of three options is true, then do something.

I have tried if "x=1 or x=2 or x=3 then" which only seems to read as "if x=1 then" for some reason. I have also tried "if x=1 then ... else if x=2 then... else if x=3 then" which has the same result. What i am trying to do when one of them is true is display a datasheet written mostly in html with a bit of asp.

Is there some kind of error in the syntax i'm using? it doesn't actually give me any errors, it just does nothing if x=2,3.
Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 15 March 2005 at 6:37pm
<%

if (X=1 OR X =2 OR X=3) then
%>
wriote code or datasheet

else write error message

<% END IF %>


that should work, the if x=1 or x=2 or x=3 then should have also worked really im not sure why not.
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 5:39pm
what i have is an if statement within a form, which basically means that it displays the value of certain records in a series of field, then you either edit, copy or decline the record which is selected by a radio button. the frm itself posts back to itself, and the value of a field that is changed depending on which button you press to submit the form determines what the script does (ie copy the record, decline it (effectively delete) or open a new part of the program to edit it). The copying and deleting works fine, but when it comes to reloading the page, i want to display the same recordset by default. However, when i come back to the page driectly after having copied or deleted, there is nothing, not even the result of the else (which is designed for when no qualifier has been given by the user by which to select the records)
 
ok, here's the code for my if statement:
 
<%
if (pascheck = 14 OR pascheck = 13 OR pascheck = 7) then
fmCL = Request.Form("ClName")
sql = "SELECT PropDate, FarmName, fmPropNo, status FROM BRProp WHERE status='Proposal Not Submitted' AND fmCL='" & fmCL & "'"
vrec.open sql, adoCon
Do WHILE NOT vrec.EOF
%>
   <tr>
    <td width="15">&nbsp;</td>
    <td width="20"><font face="Arial">
    <input type="radio" value="<%Response.Write vrec("fmPropNo")%>" name="radio"></font></td>
    <td width="92"><font face="Arial">
    <input type="text" name="PropNo_<%Response.Write vrec("fmPropNo")%>" value="<%Response.Write vrec("fmPropNo")%>" size="12" READONLY></a></font></td>
    <td width="148"><font face="Arial">
    <input type="text" name="notsure_<%Response.Write vrec("fmPropNo")%>" value="<%Response.Write "Broadacre"%>" size="20" READONLY></font></td>
    <td width="246"><font face="Arial">
    <input type="text" name="FarmName_<%Response.Write vrec("fmPropNo")%>" value="<%Response.Write vrec("FarmName")%>" size="37" READONLY></font></td>
    <td width="106"><font face="Arial">
    <input type="text" name="PropDate_<%Response.Write vrec("fmPropNo")%>" value="<%Response.Write vrec("PropDate")%>" size="14" READONLY></font></td>
    <td width="169"><font face="Arial">
    <input type="text" name="status_<%Response.Write vrec("fmPropNo")%>" value="<%Response.Write "Proposal Not Submitted"%>" size="24" READONLY></font></td>
   </tr>
<%
vrec.MoveNext
loop
%>
  </table>
  <div style="position: absolute; width: 100px; height: 38px; z-index: 1; left: 858px; top: 40px" id="cliform2a">
   <p align="center">
   <button type="submit" value="Edit<BR>Proposal" name="cont1" onMouseDown="window.document.cliform2.cont.value='cliform2Edit'">Edit<BR>
   Proposal</button></p>
   <p align="center">
   <button type="submit" value="Decline" name="cont2" onMouseDown="window.document.cliform2.cont.value='cliform2Decline'">Decline</button></p& amp; gt;
   <p align="center">
   <button type="submit" value="Copy" name="cont3" onMouseDown="window.document.cliform2.cont.value='cliform2Copy'">Copy</button></div>
<%
else
%>
   <tr>
    <td width="15">&nbsp;</td>
    <td width="20"><font face="Arial">
    <input type="radio" value="" name="radio"></font></td>
    <td width="92"><font face="Arial">
    <input type="text" name="PropNo" value="" size="12" READONLY></a></font></td>
    <td width="148"><font face="Arial">
    <input type="text" name="notsure" value="" size="20" READONLY></font></td>
    <td width="246"><font face="Arial">
    <input type="text" name="FarmName" value="" size="37" READONLY></font></td>
    <td width="106"><font face="Arial">
    <input type="text" name="PropDate" value="" size="14" READONLY></font></td>
    <td width="169"><font face="Arial">
    <input type="text" name="status" value="" size="24" READONLY></font></td>
   </tr>
  </table>
  <div style="position: absolute; width: 100px; height: 38px; z-index: 1; left: 858px; top: 40px" id="cliform2a">
   <p align="center">
   <button value="Edit<BR>Proposal" name="cont1">Edit<BR>
   Proposal</button></p>
   <p align="center">
   <button value="Decline" name="cont2">Decline</button></p>
   <p align="center">
   <button value="Copy" name="cont3">Copy</button></div>
<%
end if
%>
 
the pascheck variable is defined earlier in the script (as in before any html) as:
 
if check = "cliform2Decline" then
pascheck = 13
end if
 
if check = "cliform2Copy" then
pascheck = 14
end if
 
where check  is a holder for request.form("cont") - the value that the onmousedown changes (and it does because there is other script that runs earlier in the piece if pascheck is 13 or 14. pascheck = 7 is just when you first load that part of the program.
 
The thing that's  getting me is that it works when passcheck = 7, but not when pascheck = 13 or 14... the ifthen to set pascheck is working, but for some reason it seems not to want to recognise pascheck at that point in my code... and don't ask me to post the entire code because there's just under 1400 lines thus far... :p


Edited by ub3rl337ch3ch - 16 March 2005 at 5:47pm
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2005 at 7:16pm
At a quick glance syntax looks fine.  Just print out the value of x to ensure it's giving you it's expected values.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.