By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,870 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,870 IT Pros & Developers. It's quick & easy.

Using php variable in javascript to load page.

P: 1
So I when I go to page: www.myurl.com/test.php?uid=12345

I want to run a java script in the page that goes like
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" src="http://www.cpalead.com/load.php?uid=###'"></script>
Where "uid=###" in the script would be "uid=12345"

Can anyone help me out?
Sep 15 '07 #1
Share this Question
Share on Google+
3 Replies


pbmods
Expert 5K+
P: 5,821
Heya, Shinji. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=html]
HTML code goes here.
[/CODE]
Sep 15 '07 #2

P: 69
In your PHP, have it display the value of the field. For example, if your javascript is currently output outside of PHP, then you could do this:

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" src="http://www.cpalead.com/load.php?uid=<?php echo $_GET['uid'];?>'"></script>
  2.  
Sep 16 '07 #3

ak1dnar
Expert 100+
P: 1,584
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript">
"language" attribute has been deprecated. Instead of use "type"
Expand|Select|Wrap|Line Numbers
  1. <SCRIPT type="text/javascript">
Sep 16 '07 #4

Post your reply

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