Jump to content

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

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.