close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Redirect to different pages

Thread began 1/16/2014 9:17 am by Daryl | Last modified 1/16/2014 12:32 pm by Jason Byrnes | 1022 views | 5 replies |

DarylBeta Tester

Redirect to different pages

in 2010 I asked this same question, but was wondering if there was a better way to handle this now....?

the thread is here - http://www.webassist.com/forums/posts.php?id=9698

I have a form with a single select list, the values are blank, 1, 2 and 3.

When I submit the form I would like to be redirected to a different page depending on my selection.

1 would take me to page a, 2 would take me to page b and 3 would take me to page c

Sign in to reply to this post

Jason ByrnesWebAssist

i would use a switch case statement:


<?php
if(isset($_POST['select'])) {
switch($_POST['select']) {
case "1":
$redirPage = "page1.php";
break;
case "2":
$redirPage = "page2.php";
break;
case "3":
$redirPage = "page3.php";
break;
default:
$redirPage = "default.php";
break;
}
header("Location: ".$redirPage);
}
?>



this example assumes the name of the select is select, adjust accordingly.

Sign in to reply to this post

DarylBeta Tester

That looks a lot neater!

Where would I put this code and what would I do with the $WA_redirectURL = code?

Sign in to reply to this post

Jason ByrnesWebAssist

the code would go where you want the redirect to happen, so after any other code that processes the form.

this code would replace the $WA_redirectURL code, since it already has the header function in it.

Sign in to reply to this post

DarylBeta Tester

Thank you Jason - Your a star as always!!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...