472,354 Members | 1,610 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Auto Submitting a form

Having a little problem with a project my boss gave me. We have a web based hosting site that we have multiple databases that the users can connect to. Right now we have it set up that they can choose the database they want to login to but he wants it to login to the only database the user is allowed to see.

I have a login script that I am using on another project that works great by using redirect. The problem I have with the doing the same thing on this is I need to post a form on the server so it connects to the right database and loads the software correctly.

Example of good page:

User enters username and password. If both are correct then redirect to the next page. If not, send them to a page saying that the login was incorrect.

Example of issue page:

User enters username and password. It checks to see that both are correct and populates what database they need. Once this is done I create my form with hidden fields and then...bla. I need to simulate the clicking of the submit button so the information gets processed with no user clicking.

Here is the code I need to get auto submitted:
Expand|Select|Wrap|Line Numbers
  1. <Form Action="@ITEM_PROTOCOL@://@ITEM_SERVER@/" METHOD=POST>        
  2. <INPUT type="Hidden" NAME="USER" VALUE=strUserName>
  3. <INPUT TYPE="hidden" NAME="Password" Value=rsCheckUser("pass")>
  4. <INPUT TYPE="Hidden" NAME="Database" Value=rsCheckUser("database")>
  5. <INPUT TYPE="hidden" NAME="STATION" VALUE="View">
  7. <INPUT  NAME="FRAME"      TYPE="hidden"  VALUE="ALL"> 
The page that this code is on is all ASP and just does the checking and the goes to the regular pages. I know I can put a confirm button on the page but I want to have nothing on this page the user can see.
Any Ideas?
Jun 29 '07 #1
2 2000
3,406 Expert 2GB
There are two possibilities. One is a javascript approach which submits the form as soon as the document loads. I'm not an expert on javascript, but syntax is something like:
[html]onload="document.all.myFormName.submit()"[/html] notice your form needs to be named for this to work. Or it might need an ID. Like I said, I'm not an expert.

The second option is to pass a whole bunch of querystring data in the URL when you redirect.
Expand|Select|Wrap|Line Numbers
  1. page = "nextPage.asp?USER=" & strUserName
  2. page = page & "Password=" & rsCheckUser("pass")
  3. response.redirect page
If you previously only accepted form data with code like
Expand|Select|Wrap|Line Numbers
  1. request.form("USER")
this will need to be changed to
Expand|Select|Wrap|Line Numbers
  1. request.querystring("USER")
Expand|Select|Wrap|Line Numbers
  1. request("USER")
notice that either of these work. Now that I think about it, you could also pass this data as cookies or as session-level variables, but querystring data takes the least amount of re-writing.

Let me know if this helps or if you would like further clarification.

Jun 29 '07 #2
321 Expert 100+
I think something other than querystring would be best if users might be going through a proxy. The URI is almost always logged by default whereas POST isn't. Just my preference though.
Jun 30 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: James | last post by:
I have a form with a drop down list.. When the user selects the value from the list I want it to refresh automatically, as if the user has pressed submit... I have named the form 'test' and...
by: Greg T | last post by:
Hi, I have a rather long form that I don't want people submitting unless they are absolutely sure they are ready. I figured the easiest way to prevent an accidental form submission by way of...
by: Don | last post by:
I have a need to submit a form, but don't need the user to click on a button. How do I do this? Is there some way, using JavaScript, to setup a <form> tag to do this? Thanks, Don ----==...
by: Rick Strahl [MVP] | last post by:
Run into an interesting problem today with a client of mine: They have an ASP.Net form that they want to drive through a client side HTTP interface. I know a Web Service would be a better way to...
by: Michelle | last post by:
Hi All, I have an ASP.NET application with a session timeout of 20 minutes - for security reasons. I have a web form in this application that I need to Auto Save every 15 minutes (in case the...
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
by: Badass Scotsman | last post by:
Hello, I have an application which should never allow the back button to be pushed without refreshing the previous page. For example: Step 1: User fills in form.html and presses submit ...
by: NavinM | last post by:
I have a couple of forms that are misbehaving in FireFox, but work fine in IE. when i do submit( with submit button) a javascript function validates all of the fields entered, and stops the...
by: laredotornado | last post by:
Hi, I'm using php 5. Does anyone have any code or a function that auto submits a form that contains a single INPUT, of type = file? Thanks, - Dave
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.