* Graham * The_Netter The basics to do the same thing would be something like this
you have your form which is also in the script
and for example it sets a variable called username
This script also sets a cookie to remember the username between visits
demo of this script HERE
<!--parser:xtscript-->
# Get the username from the form
get username

# Check for a cookie or default to the entered name from the form
var $username = call cookie::get $name=mycookie;$default=$username

# If the username is set refresh or create the cookie and output the username
if $username
call cookie::set $name=mycookie; $val=$username; $expire=99999999;$force_current=1;
print <span class="">$username</span>
else

# Show the form
var $self=<xt:url />
print {{
<form action="$self" method="post">
<input name="username" />
<input type="submit" />
</form>}}
endif
<!--/parser:xtscript-->

Copy code

first time it shows the form
second time or on return visits it shows the username
2015-01-03 18:15 (edited 2015-01-03 19:15 by Graham ) · (0)

Online: Guests: 1