Jump to content

Archived

This topic is now archived and is closed to further replies.

BrianDickson

How to determine form action based depending on user input

Recommended Posts

I have a form on a page (the main customers page) that displays customer details. The form asks for:

\"Customer name\" and Which page to goto selected from a <select> list.

The first time the user goes to this page they enter a search for a company name, this takes then to a search results page with the results display as hyperliknks. when the user click on this link it takes them back to the main \"customer details\" page appending on the URL the \"CustomerID\" from the results page. The problem is that I want the user to use the drop down list to navigate to a page if the \"CustomerName\" field in the form is left blank, appending the \"customerID\" on the URL, so the page the user is being directed to can call up the relevant record. I have built an intermediate page that makes the decision on what to do next called \"wheretonext.php\" but I can only get this to work with a fixed dummy \"CustomerID\", and cant figure out how to grab or \"$_Get\" the \"CustomerID\". The re-direction code is given below:

 

<?php

$customer = $_GET[\'Customer\'];

$selform = $_GET[\'selform\'];

 

if ($customer && $selform) {

header(\"location:searchresults.php?Customer=$customer\");

}

else {

if ($selform)

header(\"location: $selform?CustomerID=4173\");

else header(\"location: originalform.php\");

}

 

?>

 

Thanks in advance :?:

Share this post


Link to post
Share on other sites

<?php

$customer = $_GET[\'Customer\'];

$selform  = $_GET[\'selform\'];

?>

 

Instead of that try

[php:1:550e777730]<?php

$customer = $_POST[\'Customer\'];

$selform = $_POST[\'selform\'];

?>[/php:1:550e777730]

 

and/or

maybe the customer input field is named customer and not Customer. Maybe :?

 

{edit}I dont get what ur asking srry{edit}

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.