473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Variable in url via echo

Hi,

I am trying to use the SID tracking via Commission Junction to create a reward site.

An example code banner display is:

Expand|Select|Wrap|Line Numbers
  1. <a href="http://www.jdoqocy.com/click-4011209-10677311?sid=$userid " target="_blank">
  2. <img src="http://www.lduhtrp.net/image-4011209-10677311" width="468" height="60" alt="Extend the life of your PC - Optimize your Slow PC" border="0"/></a>
This is stored in my database which i then echo onto the page.

I have decided $userid and this has already been called. However the url is not picking this up and instead just displays $userid rather than the number.

Has anyone any suggestions?

Many thanks!
Jul 13 '10 #1
7 1450
zorgi
431 Expert 256MB
I can not be sure this is gonna work because you gave only small sample of your code but here it is:
Expand|Select|Wrap|Line Numbers
  1. <a href="http://www.jdoqocy.com/click-4011209-10677311?sid=<?php echo $userid;?> " target="_blank">
  2.  
Jul 13 '10 #2
Hi,

Thanks - i'm not sure thats going to work as i can't call a php echo inside an echo can I?

The code displayed on the page is simply:

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. $userid = 1;
  3. echo $row_Offers['html']; ?>
  4.  
Jul 13 '10 #3
zorgi
431 Expert 256MB
what is output when you echo $row_Offers['html']
Jul 13 '10 #4
The original code I had in the first box:

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.    1. <a href="http://www.jdoqocy.com/click-4011209-10677311?sid=$userid " target="_blank">
  4.    2. <img src="http://www.lduhtrp.net/image-4011209-10677311" width="468" height="60" alt="Extend the life of your PC - Optimize your Slow PC" border="0"/></a>
  5.  
However the actual output on preview is the banner linking through to the url but instead of sid=1, it shows sid=$userid
Jul 13 '10 #5
zorgi
431 Expert 256MB
Hm... so $row_Offers['html'] is puled from database? Why don't you simply change your <....?sid=$userid....> to <....?sid=1....> in database?
Jul 13 '10 #6
@zorgi
Because the $userid is constantly being changed dependant on who log's in. (1 was just an example, $userid is actually pulled from a different table in the database). It's a rewards site so i need to be able to track the SID's in the links.

Thanks!
Jul 13 '10 #7
zorgi
431 Expert 256MB
I see. In that case you will find useful str_replace function. Variables do not just jump into the string. You need to place them there. The str_replace is your solution.
Jul 13 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Jack | last post by:
How would I add a variable that I will assign to a list of $_POST variables that I extract from a form? My form passes a value for $q. That works fine. What I want to do is run an if/else on it...
8
by: manish | last post by:
I have created a function, it gives more readability compared to the print_r function. As of print_r, it works both for array or single variable. I just want to add in it, the opton to view the...
4
by: weirdstuff | last post by:
Hi. I have this simple code: =========================================== ->Database query here (.. some code) $row=mysql_fetch_array($res); (...)
7
by: affiliateian | last post by:
Just moved web hosts and noticed that this: <?php echo "$f"; ?> used to work when there was an ?f= in the URL like so: http://www.mydomain.com/index.html?f=yes Now it doesn't at the new...
2
by: keeps21 | last post by:
I have a script that recieves an id number via the address bar when a link is clicked. ie . index.php?id=1 if the link was for the story whose ID is 1. My script checks if a user is logged in,...
2
by: milo1955 | last post by:
I have a form that passes a single variable via the GET function to a mysql databse query with the results paginated. The first page of the results work fine, but the link to the second page yields...
5
by: Guenther Sohler | last post by:
Dear Group, In the past I read something, that it is possible to print out php variables in html very fast with a simple symtax. Today I came back to php documentation, but I cannot find it...
5
by: Twayne | last post by:
Hi, If ever a newbie wants to know how much he has to learn yet, he only has to look here<g>!! ANYway: PHP 5.2.5; XP Pro SP2+, local Apache Server My actual question is: How do I get a...
3
by: igurov | last post by:
Hi all, I have the following simple cmd. script: @ECHO OFF copy "C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjects\date_string\date_string\bin\Release\date_string.exe" c:\temp set...
10
blyxx86
by: blyxx86 | last post by:
Good Morning, I have a set of variables being passed to a form via CodeIgniter's MVC setup, however I am trying to keep from duplicating the form elements if at all possible. However, I am...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.