Lamborghini Huracán LP 610-4 t
/ /

XtScript: Get

GET is a powerful function to make a dynamic web page

get is a command in XtScript to get the value of information passed to the server via GET or POST method. It is similar to GET() function in PHP.

Unlike in PHP, the information sent to the server are retrieved using only only one keyword (get) whether the method is GET either POST.

Differences in GET and POST method
GETPOST
The information is visible in the urlThe information is hidden in the url
As the information is visible in the url, the link can be bookmarked.The link cannot be bookmarked.
As the information passed with the url, it is limited to about 3000 characters.Unlimited characters length.
Example url: http://domain.com/index?name=John&Age=24-

Learn XtScript GET command from examples

GET method: Using get command to retrieve information passed in the url

- Code:
<!--parser:xtscript-->
	get car
	get food
	
	var $baseUrl = http://xtblogger.xtgem.com/a/__xtblog_entry/11479388-xtscript-get?__xtblog_block_id=1
	var $url = http://xtblogger.xtgem.com/a?__xtblog_entry=11479388
	var $value1 = car=Pickup&food=Pizza
	var $value2 = car=Truck&food=Bread
	var $value3 = car=Bus&food=Pancake

	print <p>This page has url: <b>$url</b>. Now try to revisit this page with different values in the url parameter to change the statement in the last paragraph:</p>
	
	print <p>
    print - <a href="$baseUrl&$value1">$baseUrl&$value1</a> <br/>
    print - <a href="$baseUrl&$value2">$baseUrl&$value2</a> <br/>
    print - <a href="$baseUrl&$value3">$baseUrl&$value3</a>
	print </p>
	
	print I am eating <b style="color:blue">$food</b> inside my <b style="color:red">$car</b>
<!--/parser:xtscript-->
- Result:

This page has url: http://xtblogger.xtgem.com/a?__xtblog_entry=11479388. Now try to revisit this page with different values in the url parameter to change the statement in the last paragraph:

- http://xtblogger.xtgem.com/a/__xtblog_entry/11479388-xtscript-get?__xtblog_block_id=1&car=Pickup&food=Pizza
- http://xtblogger.xtgem.com/a/__xtblog_entry/11479388-xtscript-get?__xtblog_block_id=1&car=Truck&food=Bread
- http://xtblogger.xtgem.com/a/__xtblog_entry/11479388-xtscript-get?__xtblog_block_id=1&car=Bus&food=Pancake

I am eating inside my

POST method: Using get command to retrieve information the user has submitted

- Code:
<!--parser:xtscript-->
get name
get age

print <p>Enter your name and age below to change the statement in the last paragraph:</p>
print <form method="post" action="#">
print Name \(A-z): <input name="name" type="text" value="" placeholder="Name" maxlength="30" /> <br/>
print Age \(0-9): <input name="age" type="number" value="" placeholder="Age" maxlength="3" /> <br/>
print <input type="submit" value="Submit" />
print </form>

print <p>Hi visitor, your name is <b>$name</b> and you are <b>$age</b> years old!</p>
<!--/parser:xtscript-->
- Result:

Enter your name and age below to change the statement in the last paragraph:

Name (A-z):
Age (0-9):

Hi visitor, your name is and you are years old!