I need help with a basic principle:
On my page, I use "date("njis") as an "order tracking number." .... sorta like this:
<?php
$ordernumber = date("njis");
?>
However, each time the page is reloaded, my order number changes. (obviously so!)
What basic principle can I use to keep it from changing once it is "set?"
I've tried something like this, with no success though:
<?php
if (!isset($ordernumber)) {
$ordernumber = date("njis");
}
?>
But what happens is that initially, I get my actual order number ("Hello! You're order number is 1234545"). But, then when the page is reloaded, I get "Hello! You're order number is $ordernumber).
What am I doing wrong? Is there a better way than the "isset" function? I also tried variations on
<?php
if (strlen($ordernumber) < 2) {
$ordernumber = date("njis");
}
?>
Thank you!
p.s. I don't really want any suggestions on how to come up with a better way to create an order number for my visitors, or how to use a random number generator, etc., I am just trying to figure out the basic principle of how to "keep" a variable "set" without it changing.... :-)