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:

I want to run a java script in the page that goes like
Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" src="'"></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

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

Please use CODE tags when posting source code:

HTML code goes here.
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="<?php echo $_GET['uid'];?>'"></script>
Sep 16 '07 #3

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.