agentk Posted March 10, 2008 Share Posted March 10, 2008 Hi Question: Say my website is: mygreatempire.com and I am wanting to implant a referral code on that page. How would I go about it? As an example, I want my referral URL to look somthing like this: mygreatempire.com?ws=????? How can I make "?????" (or whatever else I put there) show on my site? Basically what my site is going to say is: "You were referred by ?????". I want to be able to implant any name whatsover where the ????? is right now. I looked at implanting cookies... but have no clue how I would go about doing that. I am a semi newbie when it comes to php. Any help? Any suggestions? Figuring this out would make 2008 my best year yet. Thanks in advance! Quote Link to comment Share on other sites More sharing options...
brown2005 Posted March 10, 2008 Share Posted March 10, 2008 $ws = $_GET['ws']; echo"You were referred by: $ws"; Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 WOW... it was that simple? this is all I ever wanted. It works like a charm. Thanks a billion! Quote Link to comment Share on other sites More sharing options...
brown2005 Posted March 10, 2008 Share Posted March 10, 2008 no problems.. for future reference.. if you have index.php?page=home&view=normal you use $_GET['']; to get whats after the ? whatever you have before the = enter between the single quotes so above you would have $page = $_GET['page']; $view = $_GET['view']; hope this helps Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 Very good. That makes a lot of sense... and I understand it now. Thanks again! But... I just remembered: Can I have a default display? Assuming somebody does not provide a username, I would need $ws to display a default username. Is that at all possible? I would assume the formula would be something like: if 'ws' = blank, $ws = DefaultUsername No? Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 maybe just to clarify... the reason I need the value of $ws to change is because I will also be implanting it into a hidden input text field of a form. If that wasn't the case, I guess I could always just have a different echo... but in this case it obviously would not work. Quote Link to comment Share on other sites More sharing options...
dmccabe Posted March 10, 2008 Share Posted March 10, 2008 I think what you need is: $ws = $_GET['ws']; if (!$ws) { echo "No referall ID entered!"; } else { echo "Referall from :".$ws; } the first part sets the WS to a variable called $ws, the if statemnt checks if $ws has a value, if not it says "no referall ID entered" and if it does then it gives the second message. Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 I think that is just what I need... however, when I implant it, why does it not read $ws code by itself on the php page? I tried planting $ws by itself in the middle of the page... (apart from the code) yet it displays the following message: Parse error: syntax error, unexpected T_STRING in /home/mygreate/public_html/index.php on line 13 Here is what I need it to do on my page: <input type="hidden" name="$ws"> Basically... $ws has to have a value at all times. Shouldn't that somehow work? Quote Link to comment Share on other sites More sharing options...
dmccabe Posted March 10, 2008 Share Posted March 10, 2008 Can you show us the full code? Make sure you put [ code] [/ code] round the pasted code before submitting, so it is easier to read. Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 ok great! <table border='0' cellspacing='0' cellpadding='10' bordercolor='#cccccc'> <td> <center> <form method='post' action='http://www.aweber.com/scripts/addlead.pl' name='form' onsubmit='return checkForm()'> <input type='hidden' name='unit' value='kdbraun'> <input type='hidden' name='redirect' value='http://www.WebSite.ws/kdbraun'> <input type='hidden' name='meta_redirect_onlist' value='http://www.WebSite.ws/kdbraun'> <input type='hidden' name='meta_adtracking' value='leads'> <input type='hidden' name='meta_message' value='1'> <input type='hidden' name='meta_required' value='from'> <input type='hidden' name='meta_forward_vars' value='1'> <input type='hidden' name='referralID' value='$ws'> <table border='0' cellpadding='0' cellspacing='0'> <tr> <td nowrap> <div align='center'><strong><font face='Tahoma' size='2'>Your Email Adress:</font></strong> </div> <input type='text' name='from' value='email' size='30' /></td></td> </tr> </table> <input type='submit' value='Watch Video Now!'> </form> </center> </td> </table> </center> I got it all working except for the <input type='hidden' name='affiliate' value='$ws'> I'm thinking I might have to create two complete sites within each each of the two echos to pull up... is there any way around it? This is what I am thinking: <?php $ws = $_GET['ws']; if (!$ws) { echo "page1"; } else { echo "page2 :".$ws; } ?> It can be done but if there is a way to do it differently... I'd rather go that root. I hate working within echos Quote Link to comment Share on other sites More sharing options...
peranha Posted March 10, 2008 Share Posted March 10, 2008 <?php $ws = $_GET['ws']; if ($ws == "") { $ws = "DefaultName"; } else { //Rest of page here } ?> Is that what you are looking for?? Quote Link to comment Share on other sites More sharing options...
agentk Posted March 10, 2008 Author Share Posted March 10, 2008 Thank you very much peranha... That is exactly what I needed. I love this forum. I just joined 12 hours ago and have already learned so much. You guys rock! Thanks a billion! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.