Title: How to write a query string
Last modified: August 21, 2016

---

# How to write a query string

 *  [glrwork](https://wordpress.org/support/users/glrwork/)
 * (@glrwork)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-to-write-a-query-string/)
 * I just need to add a simple user name to the query string in order to track the
   users who are sending new people to the site.
 * Unfortunately, I have no idea how to write a query string.
 * If my url is:
    [http://mywebsite.com](http://mywebsite.com)
 * And my referrer is:
    referrer
 * … what should it look like?
 * It doesn’t seem like this is a difficult thing to do, unfortunately everything
   I’ve looked at looks like Greek to me.
    Thanks
 * [https://wordpress.org/plugins/s2member/](https://wordpress.org/plugins/s2member/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [jumbo](https://wordpress.org/support/users/jumbo/)
 * (@jumbo)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-to-write-a-query-string/#post-4747950)
 * I don’t see how this is specific to s2Member. Having said that, you’d write a
   query string like this:
    [http://mywebsite.com/?username=vincent5577](http://mywebsite.com/?username=vincent5577)
 * You’d have to have your own script deal with that on the backend by accessing
   the $_GET[‘username’] variable, such as:
 *     ```
       <?php
       if (!empty($_GET['username'])) {
           // do something with that username
       }
       ?>
       ```
   
 * The backend code could be a shortcode, something directly within your functions.
   php file, or PHP code executed directly within your page or post, although you’ll
   need a plugin to execute the 3rd version, such as:
    [http://wordpress.org/plugins/ezphp/](http://wordpress.org/plugins/ezphp/)
 *  Thread Starter [glrwork](https://wordpress.org/support/users/glrwork/)
 * (@glrwork)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/how-to-write-a-query-string/#post-4747954)
 * ok – thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to write a query string’ is closed to new replies.

 * ![](https://ps.w.org/s2member/assets/icon-256x256.png?rev=980067)
 * [s2Member – Excellent for All Kinds of Memberships, Content Restriction Paywalls & Member Access Subscriptions](https://wordpress.org/plugins/s2member/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/s2member/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/s2member/)
 * [Active Topics](https://wordpress.org/support/plugin/s2member/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/s2member/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/s2member/reviews/)

## Tags

 * [Query String](https://wordpress.org/support/topic-tag/query-string/)

 * 2 replies
 * 2 participants
 * Last reply from: [glrwork](https://wordpress.org/support/users/glrwork/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/how-to-write-a-query-string/#post-4747954)
 * Status: not resolved