PHP Redirect

#1

Hi there.
I’d like to have a PHP code that can redirect a user to a webpage specified in a form. So basically, then type a URL, hit submit, and it then redirects them to the specified URL.
How can this be done?

Thanks.

#2

I don’t know why you would do that outside of a test app, but you could handle it on the processing page, or more easily, use javascript to add that url to the action attribute on the form.

#3

It does make sense in the application I have for it. Basically I have a form with a basic text entry field that I would like people to type a URL into, and once they hit submit, it brings them to the entered URL.
Could you supply some code or information on how this is possible?
Thanks.

#4

https://www.google.com/search?q=change+action+attribute+of+form+using+javascript&rlz=1C1CHBF_enUS773US773&oq=change+action+a&aqs=chrome.1.69i57j0l5.4143j0j7&sourceid=chrome&ie=UTF-8

#5

you mean like… ehm… an adress-bar? within a… browser or something?

1 Like
#6

Alright I got it working somehow.
Basically, take a look here:
https://staff.theedgyrocket.com/
My staff can enter their username and if it is a vaild username, it will ask them for their username and password again to log them in (using .htaccess auth)

Basically when they enter their username, it tries to visit:
https://userengine.staff.theedgyrocket.com/(USERNAME)
If it is an actual file on that subdomain, it redirects them to:
https://staff.theedgyrocket.com/(USERNAME)
and their browser will ask them for their username and password (auth is via .htaccess)
If it isn’t an actual fine on that subdomain, it sends them to the 404 page on that subdomain which then redirects them to a username not found message on staff.theedgyrocket.com.