I use in the $g->select_command = a variable like
——-
$g->select_command = "select * from table where coupon = $coupon"
——–
This works fine, if I use the urlvariable
But sometimes the urlvariable could be lost, or the user forgets it.
I defined the url-variable "coupon" as
————-
$coupon = $_GET["coupon"];
if (!isset($coupon)) $coupon = '1234567';
————-
and in links as:
————-
<a href="<?php echo 'samplelink.php?coupon='.$_GET["coupon"].'&language=de'.'&e='.$_GET["e"].''.'&plz='.$_GET["plz"].''; ?>">my link</a>
How may I integrate the "if not set"-clause into this Link, as a fallback, if the variable should be not set? Using a session is not really an option, I like to solve it with the if statemement directly in the Link,.
Thank you for help
Mario
Perhaps i dont understand it completely. But you need to replace the $_GET["coupon"] with the $coupon variable.
$coupon = $_GET["coupon"];
if (!isset($coupon)) $coupon = '1234567';
<a href="<?php echo 'samplelink.php?coupon='.$coupon.'&language=de'.'&e='.$_GET["e"].''.'&plz='.$_GET["plz"].''; ?>">my link</a>
right. The replacement of the $coupon variable works aleady, but only if an URL-Parameter site.com?coupon=12334567 is set. But if site.com hat no parameter in the URL the error occours. This is why I like to have a fallback, if someone uses no Parameter in the URL. So the standardcoupon may be fill the variable and the select-command would even work if no parameter is set.