WSN Gallery
Featuresspacer Showcasespacer Reviewsspacer Demosspacer Purchasespacer Manualspacer Support
Adding Logic to Redirects
Adding Logic to Redirects
By Paul

Sometimes, some of you may want to have a form redirect differently depending on the values the user has selected in it. You can apply a special message and destination url when a particular form field has a particular value, by adding the logic to your tweaks file like this:

$redirectchecks[0] = array("profile.php?action=editprofile", "fieldname", "fieldvalue", "redirect message to display", "destination url");
$redirectchecks[1] = array("profile.php?action=editprofile", "anotherfieldname", "anotherfieldvalue", "another redirect message to display", "anotherdestination url");
$redirectchecks[2] = array("suggest.php?action=addlink", "fieldname", "fieldvalue", "redirect message to display", "destination url");


Suppose you have a custom field in your 'submit image' form called 'iwantpageb'. When it has the value 'yes' you want to send people to b.html with a "thank you for choosing page b" redirect page message in the meantime. This is what you'd use:
$redirectchecks[0] = array("suggest.php?action=addlink", "iwantpageb", "yes", "thank you for choosing page b", "b.html");


If you want to test for something other than equality, you can specify another operator in an optional 6th term. This can be any standard PHP operator: >, >=, <, <=, !=. For example, to redirect when something is greater than 5:
$redirectchecks[0] = array("suggest.php?action=addlink", "something", "5", "thank you for choosing page b", "b.html", ">");

Rating:


4/5 based on 1 vote. The median rating is 4.

Submitted: 04/02/08 (Edited 04/13/08)

Description: How to make form submissions redirect with a special message and destination when a particular form field has a particular value.

Views: 169 views. Averaging 1 per day.
In the most recent 30 day period, there've been 34 views.

Previous Article | Next Article

Home    |    Features    |    Showcase    |    Reviews    |    Demos    |    Purchase    |    Manual    |    Support