# Beginners question on \_GET

**URL:** <https://forum.kirupa.com/t/beginners-question-on--get/315166>\
**Category:** Uncategorized\
**Created:** [October 19, 2010, 10:56am UTC](https://forum.kirupa.com/t/beginners-question-on--get/315166 "2010-10-19T10:56:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![DavetriesPHP](https://avatars.discourse-cdn.com/v4/letter/d/839c29/32.png) [@DavetriesPHP](https://forum.kirupa.com/u/DavetriesPHP)\
**Post date:** [October 19, 2010, 10:56am UTC](https://forum.kirupa.com/t/beginners-question-on--get/315166/1 "2010-10-19T10:56:48Z")

</div>

In this tutorial of a google mashup

[[COLOR=#0000ff]http://code.google.com/intl/fr/apis/maps/articles/phpsqlinfo\_v3.html#AddingRow[/COLOR]](http://code.google.com/intl/fr/apis/maps/articles/phpsqlinfo_v3.html#AddingRow)

I don’t understand the insertion via this code

// Insert new row with user data  
$query = sprintf(“INSERT INTO markers " .  
" (id, name, address, lat, lng, type ) " .  
" VALUES (NULL, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);”,

It seems to me that, instead of this,  
" VALUES (NULL, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);",  
the code should be this :  
" VALUES (NULL, '$name ', '$address ', ‘$lat’, ‘$lng’, ‘$type’);",

How does the insert commande send the right values when we simply put in  
" VALUES (NULL, ‘%s’, ‘%s’, ‘%s’, ‘%s’, ‘%s’);",

Here’s what I don’t understand : at the beginning of the php code, we create these variables from values in the Get array passed by the URL.

$name = $\_GET[‘name’];  
$address = $\_GET[‘address’];  
$lat = $\_GET[‘lat’];  
$lng = $\_GET[‘lng’];  
$type = $\_GET[‘type’];

Wasn’t the purpose of the above bit of code to create variables whose values we then insert into the table ?

I expect us to do this sort of thing :  
// Insert new row with user data  
$query = sprintf(“INSERT INTO markers " .  
" (id, name, address, lat, lng, type ) " .  
" VALUES (NULL, '$name ', '$address ', ‘$lat’, ‘$lng’, ‘$type’);”,

But it looks af we create those variables, $name, etc. and then never use them again.

Thanks for setting me straight !
