Hey guys, I was trying to do this in PHP but I don't think I can.
I think this requires some kind of client end programming.
Anyways, if you select the first option, it sends you to one page, and if you select the second option, it sends you to another page.
Option 1: --> This will send you to page1.html via POST method along with any hidden types.
Option 2: --> This will send you to page2.html via POST method along with any hidden types.
I don't think there is only a way doing it with POST data, but it's by using a socket to the domain. however, the sockets won't send the user to the page, it would only send a POST request with its fields.
this code can do the job, but is a vile hack:
The second way (that is commented out) is just an imaginary code from that some people says it works, I am not sure, I haven't test it.
I hope this helps.
I will take a look at your code and see what I could possibly use.
The login page has username and password as the input fields
with a submit button.
Basically the main page, let's call it: index.html is the login page. There's a drop down with only 2 options.
You can put in your username/password combo and whichever dropdown you select takes you to either page1.html or page2.html.
By default, the first option goes to page1.html and obviously if you choose the 2nd option, it takes you to page2.html...
I will try out your code though, hey, if it works, then it works...and I will be eternally greatfull!
I've also since this behavior around, but it's been a while (in the Web 1.0 era).
with ajax is the same thing as using curl, you can send the post data but it won't redirect you to the page you send the post data, as far as I know. I think the most viable is having another form besides the one the user needs to select the option and send that with the post data that you want.
Now I see things getting much more dynamic and I'm trying to keep up. Shame on me for "living" off what I knew and never really learning more. But at my job, I'm kinda the jack of all trades (master of none) so it's very difficult for me to keep up when I'm also the Cisco guy, Firewall guy, Linux server guy etc....
I'm going to look into CURL, that COULD be what I'm looking for....
I think I'm pretty close to figuring this out, when I do, I will post my solution...thanks for your helpful tips!!
I also learned the web 1.0 knowledge, just about 2 years ago I started learned up all the new stuff that was happening. I understand how overwhelming all this is getting. But man Cisco services is in itself a lot of work.
kudos man, that you are trying to figure all this out besides being the go to guy.
About your problem, are you trying to have a login form with a password textbox, username textbox, and the combobox to select where would the username and password input would go to be processed. After this do you want to send the user back to the index (or main page) already logged in if the loggin was successful?
If that's the case it can be done with curl or an ajax request.
Yeah Cisco is a handful....let's not even get into that! It is fun though!
Anyways, yeah, I think what you described is what I am attempting to do.
To make it simple, let's just say that the 2 options would go to 2 different websites with the username/password posted to them.
So say the two options were: AOL.com and TALKPHP.com
I would select one of the two, put in the username/password, hit submit, and it would then post my username/password post data to the selected site, and the selected site would take care of logging me in...
I thought that I could get clever and have a "switch.php" file that would use the PHP "header function" to redirect me to either site based on what I selected, but the problem is that I lose the $_POST[username] and $_POST[password] in the process of the redirection...
If only I'm able to hold onto the data and pass it forward then all is dandy....
I think I'm close, I found something like this with CURL but I'm getting an error...
Fatal error: Call to undefined function: curl_init() in /usr/local/apache/test.html on line 2
I know that I have curl installed so I'll have to dig into this error further....
Maybe the curl module is not enable in the php config file.
This is a good website with examples of curl
|All times are GMT. The time now is 03:29 AM.|
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0