Redirecting a user to another custom url on another website

I’m currently running my website on Wordpress. I have a landing page setup on the website. I need to incorporate a feature where once the contact form is filled up on the landing page, the user gets redirected to a different website. That particular web page will be customized based on the values entered by the user in the contact us form.

For example:-

  • User enters ‘his name’ into my contact form, presses submit
  • He is then redirected to Google and the search term (‘His name’) is pre-filled for him there

Now I know this feature could be tricky to incorporate on WP, but I was thinking of utilizing Selenium Web Driver for this. Where The data that the user fills within the contact-us form gets converted into a Python data structure, and that data structure can be referenced by the selenium web driver and then selenium can use that data to go to the target page and incorporate the details within the target page. Once this is done, I would like the user to be redirected to this pre-processed and prefiled target page.

Is this a viable approach to the problem? Is there a better or cleaner / simpler way I can get this done?

I know this thread could sound confusing to some, but I am trying to word the issue as accurately as I possibly can.

Many Thanks

Since WP is based on PHP, a PHP solution would seem natural.
You can easily redirect with a header location.

1 Like

There’s also a WP wrapper for this, which does some sanitizing and extra checks:

… but under the hood it boils down to setting the location header as shown by @SamA74.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.