ASP db results on same page as form

Results 1 to 5 of 5

Thread: ASP db results on same page as form

  1. #1
    anotherNEWBIE Guest

    Default ASP db results on same page as form

    I have a web page with a simple 3 text box form, and I want the database results (table)to appear on the same page below the text boxes. I placed the db code below my form, called the same .asp page from the form, and it works. Only problem--> when i first access the page, the db code is looking for variables from the form, of which there is none. My user-entry validation error code picks up the empty boxes and it sends the error code. What can I do (short of using a frameset) to keep the error code from working when a user first accesses this asp page?

  2. #2
    Nathen Grass Guest

    Default RE: ASP db results on same page as form

    Check for the value of the Submit button first. If the value is an empty string then show the form. If the value is not an empty string then the Submit button was clicked so process the other form elements and execute your db code.

  3. #3
    anotherNEWBIE Guest

    Default RE: ASP db results on same page as form

    Thanks, Nathen My submit button does have a value, but I do not understand what to do as a result of this. can you elaborate?

  4. #4
    Nathen Grass Guest

    Default RE: ASP db results on same page as form

    The best way to explain is to show an example:<BR><BR>&#060;%If Request.Form("Action") = "Submit" Then%&#062;<BR><BR>&#039Check other form elements<BR>&#039DB Code here<BR><BR>&#060;%Else%&#062;<BR><BR>&#060;form method="post" action="this.asp"&#062;<BR>&#060;input type="text" name="textbox" value=""&#062;<BR>&#060;input type="submit" name="Action" value="Submit"&#062;<BR>&#060;/form&#062;<BR><BR>&#060;%End If%&#062;<BR><BR>When the page loads it will check to see if the value of the Submit button is the value specified in the form (In this case the value is "Submit"). If the value is there it will execute your code to check the other form elements and the db code. If not it will display the form.


  5. #5
    anotherNEWBIE Guest

    Default RE: ASP db results on same page as form

    Nathen...got it to work!!!<BR><BR>Thanks!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •