weird asp error...

Discussion in 'Software' started by mr_flea, Jan 31, 2004.

  1. mr_flea

    mr_flea First Sergeant

    I don't see anything wrong with my asp file, but I still get an error. Here's my error:
    Error Type:
    Microsoft VBScript compilation (0x800A0400)
    Expected statement
    /contact.asp, line 46
    case else

    Here's my source:

    <!--#include virtual="header.txt" --><%
    action
    = trim(request.form("action"))selectcase action

    case "submit"
    name
    = trim(request.form("name"))
    email
    = trim(request.form("email"))
    category
    = trim(request.form("category"))
    subject
    = trim(request.form("subject"))
    message
    = trim(request.form("message"))if name="" then
    feild
    ="name"
    error="1"
    elseif email="" then
    feild
    ="name"
    error="1"
    elseif category="NA" then
    feild
    ="category"
    error="1"
    elseif subject="" then
    feild
    ="subject"
    error="1"
    elseif message="" then
    feild
    ="message"
    error="1"
    elseendifendifendifendifendifIferror="1" then
    response
    .write("Sending Failed. Missing field: & feild &.")else
    response
    .write("Your message has been sent.")caseelse%>
    <font size="+2" color="#C0C0C0"><center>
    Contact
    </center></font><br><table><tr><td align="right"><font color="#C0C0C0">
    Your name:
    </font></td><td>
    <form action="
    http://www.domain.com/" method="post">
    <input type="text" name="name" size="30" maxlength="30">
    </td></tr><tr><td align="right"><font color="#C0C0C0">
    Your email address:
    </font></td><td>
    <input type="text" name="email" size="30" maxlength="100">
    </td><tr><td align="right"><font color="#C0C0C0">
    Category:
    </font></td><td>
    <select name="category">
    <option value="NA"> --------------------------------------------</option>
    <option value="Site Suggestion"> Site Suggestion</option>
    <option value="Broken Link"> Broken Link</option>
    <option value="Submit Media"> Submit Media</option>
    <option value="Legal"> Legal</option>
    </select>
    </td></tr><tr><td align="right"><font color="#C0C0C0">
    Subject:
    </font></td><td>
    <input type="text" name="subject" size="60" maxlength="100">
    </td></tr><tr><td align="right" valign="top"><font color="#C0C0C0">
    Message:
    </font></td><td><textarea name="message" cols="45" rows="5" wrap="on"></textarea>
    </td></tr></table><br><table><tr><td width="27%"></td><td width="23%"><center>
    <input type="submit" value="Submit">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="Reset">
    </form>
    </center></td><td width="50%"></td></tr>

    <%endselect%><!--#include virtual="footer.txt" -->




    Any ideas?
     
    Last edited: Jan 31, 2004
  2. goldfish

    goldfish Lt. Sushi.DC

    I hope that board screwed up your coding with bad formatting, because otherwise thats horrible coding! You could try doing Response.Write("%> nada nada nada <%")
    since that would be a statement.. but as you probably know asp errors are never quite what they're sposed to be.

    its not strictly nececary to have that case select... you could just have a big ole If there..

    action = trim(request.form("action"))
    if action = "submit" then

    all that code here
    else

    all that html here
    end if
     
  3. mr_flea

    mr_flea First Sergeant

    The board screwed up the formatting. I used case statments because they are faster. I used the if else if because it is inside the case statements. I'm quite familiar with asp errors not being what they're supposed to because I used to be a vbscript programmer, and asp uses the same way of returning errors. I can't quite figure out what's wrong... the code looks fine to me.

    I was messing with and just figured out what the problem was. I forgot to close the last if there.
     
  4. goldfish

    goldfish Lt. Sushi.DC

    Hmm.. incidentally have you tried it on another server? just thinking maybe the servers got a screwed up VBScript library or somthing...
    (oh yeah and stick the code in [ code ] tags to un-screw up the formatting)

    ach... didnt see that.
     
  5. mr_flea

    mr_flea First Sergeant

    I haven't tried it on another server because I'm a little short on them... I just use my personal computer as a server. I don't think the vbscript library is messed up because it used to come up with screwey errors like that on a different computer, too. I'll remember the code tag thing.

    One more thing goldy... any ideas on how the board makes the internet browser not process the HTML that is posted? I need some way to do that on my site...
     
  6. Kodo

    Kodo SNATCHSQUATCH

    what the hell is this line?


    elseendifendifendifendifendifIferror="1" then

    if you do an if elseif, you only need one END IF.. ;)
     
  7. goldfish

    goldfish Lt. Sushi.DC

    in php it is
    Code:
    addslashes(string);
    
    in asp it's
    Code:
    Server.HTMLEncode(string)
    
    i think
     
  8. Kodo

    Kodo SNATCHSQUATCH

    that is correct
     
  9. mr_flea

    mr_flea First Sergeant

    And it will show it as regular text? Niiiicccee...

    They even made an asp command for it... surprising...

    @Kodo
    About the string you see there, the board mangled it badly... here is the real stuff:

    Code:
    [i][color=#ff0000][size=3]<!--[/size][/i][/color][b][color=#fffff0][size=3]#include[/size][/b][/color][size=3] [b]virtual[/b]="[b]header.txt[/b]" [i][color=#ff0000]-->[/i][/color][/size][b][color=#ff0000][size=3]<%[/size][/b][/color]
    [size=3][b]action[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"action"[/i][color=#008000]))[/color][b][color=#008000]select[/b][/color][/size][b][color=#008000][size=3]case[/size][/b][/color][size=3] [b]action[/b][/size]
     
    [b][color=#008000][size=3]case[/size][/b][/color][size=3] [i]"submit"[/i] [/size]
    [size=3][b]name[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"name"[/i][color=#008000]))[/color][/size]
    [size=3][b]email[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"email"[/i][color=#008000]))[/color][/size]
    [size=3][b]category[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"category"[/i][color=#008000]))[/color][/size]
    [size=3][b]subject[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"subject"[/i][color=#008000]))[/color][/size]
    [size=3][b]message[/b] [color=#008000]=[/color] [b]trim[/b][color=#008000]([/color][b]request[/b][color=#008000].[/color][b]form[/b][color=#008000]([/color][i]"message"[/i][color=#008000]))[/color][b][color=#008000]if[/b][/color][/size][size=3] [b]name[/b][color=#008000]=[/color][i]""[/i] [b][color=#008000]then[/b][/color][/size][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][i][size=3]"name"[/size][/i]
    [b][color=#008000][size=3]else[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][size=3] [b]email[/b][color=#008000]=[/color][i]""[/i] [b][color=#008000]then[/b][/color][/size][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][i][size=3]"email"[/size][/i]
    [b][color=#008000][size=3]else[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][size=3] [b]category[/b][color=#008000]=[/color][i]"NA"[/i] [b][color=#008000]then[/b][/color][/size][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][i][size=3]"category"[/size][/i]
    [b][color=#008000][size=3]else[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][size=3] [b]subject[/b][color=#008000]=[/color][i]""[/i] [b][color=#008000]then[/b][/color][/size][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][i][size=3]"subject"[/size][/i]
    [b][color=#008000][size=3]else[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][size=3] [b]message[/b][color=#008000]=[/color][i]""[/i] [b][color=#008000]then[/b][/color][/size][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][i][size=3]"message"[/size][/i]
    [b][color=#008000][size=3]else[/size][/b][/color][i][color=#0000f0][size=3]' Mailer program here[/size][/i][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]If[/size][/b][/color][b][color=#008000][size=3]error[/size][/b][size=3]=[/size][/color][size=3][i]""[/i] [b][color=#008000]then[/b][/color][/size]
    [size=3][b]response[/b][color=#008000].[/color][b]write[/b][color=#008000]([/color][i]"<br><font color=""#C0C0C0"">Your message has been sent.</font><br><br>"[/i][color=#008000])[/color][b][color=#008000]else[/b][/color][/size]
    [size=3][b]response[/b][color=#008000].[/color][b]write[/b][color=#008000]([/color][i]"<br><font color=""#C0C0C0"">Sending failed. Missing field: "[/i] [color=#008000]&[/color][b][color=#008000]error[/b][/color][/size][size=3][color=#008000]&[/color] [i]"</font><br><br>"[/i][color=#008000])[/color][b][color=#008000]end[/b][/color][/size][b][color=#008000][size=3]if[/size][/b][/color][b][color=#008000][size=3]case[/size][/b][/color][b][color=#008000][size=3]else[/size][/b][/color][b][color=#ff0000][size=3]%>[/size][/b][/color]
    [size=3][b]<font[/b] size=[b]"+2"[/b] color=[b]"#C0C0C0"><center>[/b][/size]
    [size=3]Contact[/size]
    [size=3][b]</center></font><br><table><tr><td[/b] align=[b]"right"><font[/b] color=[b]"#C0C0C0">[/b][/size]
    [size=3]*Your name:[/size]
    [b][size=3]</font></td><td>[/size][/b]
    [size=3][b]<form[/b] action=[b]"contact.asp"[/b] method=[b]"post">[/b][/size]
    [size=3][b]<input[/b] type=[b]"hidden"[/b] name=[b]"action"[/b] value=[b]"submit">[/b][/size]
    [size=3][b]<input[/b] type=[b]"text"[/b] name=[b]"name"[/b] size=[b]"30"[/b] maxlength=[b]"30">[/b][/size]
    [size=3][b]</td></tr><tr><td[/b] align=[b]"right"><font[/b] color=[b]"#C0C0C0">[/b][/size]
    [size=3]*Your email address:[/size]
    [b][size=3]</font></td><td>[/size][/b]
    [size=3][b]<input[/b] type=[b]"text"[/b] name=[b]"email"[/b] size=[b]"30"[/b] maxlength=[b]"100">[/b][/size]
    [size=3][b]</td><tr><td[/b] align=[b]"right"><font[/b] color=[b]"#C0C0C0">[/b][/size]
    [size=3]*Category:[/size]
    [b][size=3]</font></td><td>[/size][/b]
    [size=3][b]<select[/b] name=[b]"category">[/b][/size]
    [size=3][b]<option[/b] value=[b]"NA">[/b] --------------------------------------------[b]</option>[/b][/size]
    [size=3][b]<option[/b] value=[b]"Site Suggestion">[/b] Site Suggestion[b]</option>[/b][/size]
    [size=3][b]<option[/b] value=[b]"Broken Link">[/b] Broken Link[b]</option>[/b][/size]
    [size=3][b]<option[/b] value=[b]"Submit Media">[/b] Submit Media[b]</option>[/b][/size]
    [size=3][b]<option[/b] value=[b]"Legal">[/b] Legal[b]</option>[/b][/size]
    [b][size=3]</select>[/size][/b]
    [size=3][b]</td></tr><tr><td[/b] align=[b]"right"><font[/b] color=[b]"#C0C0C0">[/b][/size]
    [size=3]*Subject:[/size]
    [b][size=3]</font></td><td>[/size][/b]
    [size=3][b]<input[/b] type=[b]"text"[/b] name=[b]"subject"[/b] size=[b]"60"[/b] maxlength=[b]"100">[/b][/size]
    [size=3][b]</td></tr><tr><td[/b] align=[b]"right"[/b] valign=[b]"top"><font[/b] color=[b]"#C0C0C0">[/b][/size]
    [size=3]*Message:[/size]
    [size=3][b]</font></td><td><textarea[/b] name=[b]"message"[/b] cols=[b]"45"[/b] rows=[b]"5"[/b] wrap=[b]"on"></textarea>[/b][/size]
    [size=3][b]</td></tr></table><br><table><tr><td[/b] width=[b]"27%"></td><td[/b] width=[b]"23%"><center>[/b][/size]
    [size=3][b]<input[/b] type=[b]"submit"[/b] value=[b]"Submit">[/b][i]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[/i][b]<input[/b] type=[b]"reset"[/b] value=[b]"Reset">[/b][/size]
    [b][size=3]</form>[/size][/b]
    [size=3][b]</center></td><td[/b] width=[b]"50%"></td></tr>[/b][/size]
     
    [b][color=#ff0000][size=3]<%[/size][/b][/color][b][color=#008000][size=3]end[/size][/b][/color][b][color=#008000][size=3]select[/size][/b][/color][b][color=#ff0000][size=3]%>[/size][/b][/color][i][color=#ff0000][size=3]<!--[/size][/i][/color][b][color=#fffff0][size=3]#include[/size][/b][/color][size=3] [b]virtual[/b]="[b]footer.txt[/b]" [i][color=#ff0000]-->[/color][/i][/size]
    [size=1][color=#ff0000][size=2][color=black]
    [/color][/size][/color][/size]

    [edit] crap, the board mangled that too... well it was indented and spaced, and not on one line.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds