Jump to content


Photo

How to determine form action based depending on user input


  • Please log in to reply
1 reply to this topic

#1 BrianDickson

BrianDickson
  • New Members
  • Pip
  • Newbie
  • 2 posts
  • LocationKent, England

Posted 19 June 2003 - 10:48 AM

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 :?:
++++++++++++++++++++++++++++++ [br] Let peace reign over your life, and be cool.

#2 Freekstyle

Freekstyle
  • Members
  • Pip
  • Newbie
  • 3 posts
  • LocationIn a clam.

Posted 07 August 2003 - 03:02 PM

<?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}




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users