Adding a record and reload the same page at once ?

Results 1 to 2 of 2

Thread: Adding a record and reload the same page at once ?

  1. #1
    John More Guest

    Default Adding a record and reload the same page at once ?

    I have a ASP page where a table is displayed. On the same page there is a form where you can ad a record in that table. The code works.<BR><BR>When i push the SUBMIT button, i go to the ASP page where my form is added to the database. Then i have to push a link to go back to the page where the table is.<BR><BR>Is there a way to ad the form and reload the (table) page at once? I want to reload the page where the form is as well, i don&#039t want to see the page that say: data is added.<BR><BR>Someone has any ideas ?<BR><BR>(NT4, IIS, ASP, and a access 97 database)<BR><BR>Thanx,<BR>John More<BR><BR>

  2. #2
    Troy the ASP Boy Guest

    Default RE: Adding a record and reload the same page at on

    John:<BR><BR>I just got done redoing my asp pages to include this function. Here&#039s my solution.<BR><BR>----------mypage.asp------------------<BR>have the form submit the information to the same page. in the form that uses the submit button use a hidden field that describes the action you want to take.<BR><BR>&#060;form method="post" action="mypage.asp"&#062;<BR>&#060;input type="hidden" name="action" value="update"&#062;<BR>&#060;input type="text" name="variable"&#062;<BR>&#060;input type="submit" name="submit" name="submit"&#062;<BR><BR>now what you&#039ll need to do is add some VBscript to the beginning of your code to check for the action.<BR><BR>&#060;% if Request.Form("action") = Null then %&#062;<BR> &#060;center&#062;Data Table&#060;/center&#062;<BR>&#060;% Else %&#062;<BR> (UPDATE RECORDSET)<BR> &#060;center&#062;Data Table&#060;/center&#062;<BR>&#060;% End If %&#062;<BR><BR>Essentially what happens is you embed the action you want to take into the submit form. you then submit the info to the same page. if the action variable is null then display the info, otherwise if the action variable is "update" then update the recordset and then display the table info.<BR><BR>hope this helps,<BR>troy the asp boy<BR><BR><BR>

Posting Permissions

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