This topic is locked

multiple redirect based on selected field

6/22/2006 4:28:14 PM
PHPRunner General questions
Allenh author

I have four tables; applicants, q1, q2, q3.

In the applicants table, there is a long form of personal information, and at the end they have to select the type of job they are applying for; a, b, or c.

Based on the the selection of 'type of job', on submit, I want to redirect them to the appropriate questions; q1, q2, q3.
How do I do this? It's not a simple redirect because it is based on content in the field 'type of job'.
Thanks in advance for your help.

J
Jane 6/23/2006

Hi,
you can so it using Before record updated and After record updated events.

function BeforeEdit(&$values, $where)

{

if ($values["Field"]=="q1")

$_SESSION["question] = 1;

if ($values["Field"]=="q2")

$_SESSION["question] = 2;

if ($values["Field"]=="q3")

$_SESSION["question] = 3;

return true;

}


function AfterEdit()

{

// put your custom code here

if ($_SESSION["question"]==1)

header("Location: q1_list.php");

if ($_SESSION["question"]==2)

header("Location: q2_list.php");

if ($_SESSION["question"]==3)

header("Location: q3_list.php");

}



where Field is your actual field name.