lammy
Posts: 49
|
| Posted: 04/13/2007, 1:24 AM |
|
Hi all
This is another problem with php and Javascript,
the code below is held in a table in my database, This links to an affiliate site for a booking agency. What i need to do is append the user_id onto the end of the code (&no=USER_ID) so I can track who is using the site, Problem is I cant seem to get the user_id into a javascript variable. I have tried using <?=$USER_ID?> but when i run program it just shows <?=$USER_ID?> and not the actual value. I would really appreciate some help with this problem.
<script type="text/javascript">
var uri = 'http://impgb.xxxxxxxxx.com/imp?type(img)g(xxxx)a(xxxxxx)' + new String (Math.random()).substring (2, 11);
document.write('<a href="http://clkuk.xxxxxxxxxx.com/click?p=xxx&a=xxxxxxx&g=xxxx &no=USER_ID '" target="_blank"><img src="'+uri+'" border=0></a>');
</script>
|
 |
 |
Damian Hupfeld
|
| Posted: 04/13/2007, 4:19 AM |
|
Replace USER_ID with a LABEL and use one of several methods to set its value
to that of the user.
"lammy" <lammy@forum.codecharge> wrote in message
news:5461f3e4e8321b@news.codecharge.com...
> Hi all
>
> This is another problem with php and Javascript,
> the code below is held in a table in my database, This links to an
> affiliate
> site for a booking agency. What i need to do is append the user_id onto
> the end
> of the code (&no=USER_ID) so I can track who is using the site, Problem is
> I
> cant seem to get the user_id into a javascript variable. I have tried
> using
> <?=$USER_ID?> but when i run program it just shows <?=$USER_ID?> and not
> the
> actual value. I would really appreciate some help with this problem.
>
> <script type="text/javascript">
> var uri = 'http://impgb.xxxxxxxxx.com/imp?type(img)g(xxxx)a(xxxxxx)' + new
> String (Math.random()).substring (2, 11);
> document.write('<a
> href="http://clkuk.xxxxxxxxxx.com/click?p=xxx&a=xxxxxxx&g=xxxx &no=USER_ID '"
> target="_blank"><img src="'+uri+'" border=0></a>');
> </script>
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.yessoftware.com/
>
|
|
|
 |
mkmind
Posts: 18
|
| Posted: 04/15/2007, 10:35 PM |
|
Hello.
You can give your Value like the UserID with a hidden Field to your Javascript. Insert a hidden Field to your Side/or Form. Set the Value from The Hidden Field in BeforeShow of it,
eg:
$yourFormName->HiddenFieldname->SetValue(CCGetUserID());
and then write your Javascript like this...
<script type="text/javascript">
var uri = 'http://impgb.xxxxxxxxx.com/imp?type(img)g(xxxx)a(xxxxxx)' + new String (Math.random()).substring (2, 11);
document.write('<a href="http://clkuk.xxxxxxxxxx.com/click?p=xxx&a=xxxxxxx&g=xxxx&no={HiddenUserID}'" target="_blank"><img src="'+uri+'" border=0></a>');
</script>
sorry about my english
greets martin k.
|
 |
 |
teke507
Posts: 69
|
| Posted: 04/19/2007, 7:45 PM |
|
create a label or invisible text box whatever you like the make the default value of the textbox/label CCGetSession("User_ID")
for arguments sake say your label is named User_Id_Label
<script type="text/javascript">
var uri = 'http://impgb.xxxxxxxxx.com/imp?type(img)g(xxxx)a(xxxxxx)' + new String (Math.random()).substring (2, 11);
document.write('<a href="http://clkuk.xxxxxxxxxx.com/click?p=xxx&a=xxxxxxx&g=xxxx &no={User_Id_Label} '" target="_blank"><img src="'+uri+'" border=0></a>');
</script>
make sure your images src is after your label otherwise your default values will not get passed correctly by after i mean it literally make sure your label or text box is above your image src {User_Id_Label}
|
 |
 |
teke507
Posts: 69
|
| Posted: 04/19/2007, 7:49 PM |
|
I just reread mkminds response and it looks like i told you the same thing sorry for the redundancy
|
 |
 |
|