SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2008
    Location
    London, UK
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question using a link to input text in a textfield

    Hi guys,

    Not sure if this is the right area to discuss this but here goes. I'm helping to create a marketing campaign for a client and one part of this is that we're using QR codes on the advertising. I was wondering if it would be possible to put a text string into the URL that would then take them to the checkout page and populate the Promotional Code text box with the relevant discount code?

    Would that need Javascript/JQuery functionality or can PHP do that?

    Charlie

  2. #2
    SitePoint Addict
    Join Date
    Oct 2009
    Location
    London, UK
    Posts
    382
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    You could probably do that using javascript/jquery or PHP.

    If the url is something like: http://www.example.com?code=r4dxp9yt

    $_GET['code'] will contain your promo code in PHP.

    with javascript you'd probably have to use a regex on the address bar (window.location):
    Code:
    var code = window.location.href.match(/\?code=([a-z0-9]+)/);
    code[1] will now contain your promo code.


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •