I am wanting to use one page that is linked to from two different pages. Below are my scenarios:
1) The user clicks a hyperlink to be directed to the page with a salesID in the URL
2) The user navigates directly to the page and no salesID is passed in the URL
Now to account for each situation above ->
1) If salesID IS NULL then get parameters from the page
2) If salesID IS NOT NULL then onload() display all relevant data for the salesID passed
I know how to write the query to load the page by default with a parameter, and I know how to load the page with parameters captured on the page from a button press event. What I do not know how to do is to combine the two and check multiple criteria. What I want to do is on pageload() evaluate criteria 1 - if a salesID is passed to the page, then go ahead and populate the page with all data for that salesID. If criteria 2 is true, then do not populate the page, wait for user input to select from select boxes and push the button.
This is basics of how I have the syntax for the page:
<?php
//Capture variable from URL
$salesID = urldecode($_GET['salesID']);
//Check if variable is set
if (isset($_GET['salesID'])) {
//A salesID was passed to the page so load that data by default
//ignoring any variables set on the page
}
else {
if (isset($_POST['btnpressevent'])) {
//button has been pressed capture variables from page and run query
}
}
?>