Results 1 to 3 of 3

Thread: Help with URL variable conditional statement

  1. #1
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Help with URL variable conditional statement

    Nature of my goal:
    I'am building an affiliate program that pays commissions to affiliates PayPal account.

    Problem:
    If an affiliate url is like index.php?refer=paypal@mail.com
    and I use PHP code on the "Continue page" on an HTML link -
    PHP Code:
    <a href="offerpage.php<?php $ref $_GET['refer'];echo "?refer=$ref"?>">Continue to offer</a>
    This works decent, but what if the URL does not have a "refer" variable?
    ie: mysite.com/index.php

    How can I set it up so that it checks whether or not a value for "refer" exists, and if not than make the link like so-
    mysite.com/offerpage.php?refer=mypaypal@mail.com

    I hope this is not too confusing

    Best Regards
    ~Ross
    Last edited by Snookerman; 06-06-2009 at 10:56 AM.

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    Try this

    PHP Code:
    <a href="offerpage.php<?php $ref $_GET['refer']; if ($ref==""){ echo "?refer=mypaypal@mail.com";}else{ echo "?refer=$ref"?>">Continue to offer</a>

  3. The Following User Says Thank You to forum_amnesiac For This Useful Post:

    Spinethetic (06-05-2009)

  4. #3
    Join Date
    Aug 2005
    Posts
    115
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default

    Thank you, this line seems to be working for me

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
  •