I have three variables in a record set that retrieves results from URL parameters:
variables =
$varAccess_rsAwaitingSecureAccess = "-1";
if (isset($_GET['AccessCode'])) {
$varAccess_rsAwaitingSecureAccess = $_GET['AccessCode'];
}
$varAddress_rsAwaitingSecureAccess = "-1";
if (isset($_GET['UserAddress2'])) {
$varAddress_rsAwaitingSecureAccess = $_GET['UserAddress2'];
}
$varVerified_rsAwaitingSecureAccess = "-1";
if (isset($_GET['emailVerified'])) {
$varVerified_rsAwaitingSecureAccess = $_GET['emailVerified'];
}
URL Parameters =
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Arequipa_Reef& amp;AccessCode=No_Access">Arequipa Reef</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Ensenada_Reef& amp;AccessCode=No_Access">Ensenada Reef</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Fairfield_Lodg e&AccessCode=No_Access">Fairfield Lodge</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Millington_Cou rt&AccessCode=No_Access">Millington Court</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Nautica_Houses &AccessCode=No_Access">Nautica la Marina Houses</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Onyx_Mews& AccessCode=No_Access">Onyx Mews</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Quadrangle_Hou se&AccessCode=No_Access">Quadrangle House</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Quartz_House&a mp;AccessCode=No_Access">Quartz House</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Topaz_House&am p;AccessCode=No_Access">Topaz House</a></li>
<li><a href="grantAccess.php?emailVerified=1&UserAddress2=Trujillo_Court &AccessCode=No_Access">Trujillo Court</a></li>
I want to set default values for the variables for all three so if someone manages to view the page without selecting a URL parameter, they will get all valid results.
The default value for variable 'AccessCode' will be 'No_Access' ... Not a problem
The default value for variable 'emailVerified' will be '1' ... Not a problem
But for the variable 'UserAddress2' I need all parameters in the Default value... for example:
$varAddress_rsAwaitingSecureAccess = "Arequipa_Reef, Ensenada_Reef, Fairfield_Lodge, Millington_Court, Nautica_Houses, Onyx_Mews, Quadrangle_House, Quartz_House, Topaz_House, Trujillo_Court,";
if (isset($_GET['UserAddress2'])) {
$varAddress_rsAwaitingSecureAccess = $_GET['UserAddress2'];
}
I realise the above is wrong so how can I do this.. ?
Please help.
The best way to accomplish this is to build the WHERE clause dynamically, or else have a different WHERE clause that you use in these situations. In other words, test the value of the querystring variables and if they are empty, use a different WHERE clause that does not include the address condition.
Also, this question belongs in the app dev forum.
North America
Europe, Middle East and Africa
Asia Pacific