I was handed a cs-cart project and i've been having some minor issues, I think i'm missing something.
given this (self explanatory) code :
{if $smarty.get.mypin ==""}
OK
{assign var="my_pin_q" value=$smarty.post.mypin}
{else}
NOT OK
{assign var="my_pin_q" value=$smarty.get.mypin}
{/if}
So i'm checking if a get paramter exists, if it does i'm saving it to a local varaible, else i'm saving the .post variable(instead of of the get).
This is followed by :
<input type="hidden" name="mypin" value = "{$my_pin_q}">
(inside a form ofcourse)
the issue at hand is that for some reason .post.mypin
is always empty, even though it's passed correctly through the form.(I checked the POST request).
Is this normal? Does smarty store the request variables somewhere else?
You should not use comparison $smarty.get.mypin ==""
. You should use isset
instead. Below code should work for you (notice changed blocks inside if and else):
{if isset($smarty.get.mypin)}
{assign var="my_pin_q" value=$smarty.get.mypin}
{else}
{assign var="my_pin_q" value=$smarty.post.mypin}
{/if}
Value of PIN: {$my_pin_q}