PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 8th, 2003, 11:32 AM
johnn johnn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Southern California, USA
Posts: 48 johnn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Transfering variables to php script

Hi,

The following code does not transfer variables r and u to a php script, probably syntax error. What's wrong?

<script language="JavaScript" src="http://www.abcd.net/feed.php?r="+escape(document.referrer)+"u="+escape(navigator.userAgent)></script>

Thanks

Reply With Quote
  #2  
Old September 8th, 2003, 12:56 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
You're trying to execute script code within the script declaration. I'm not sure I understand what you're even trying to do. If you're specifying a src for a javascript, it should be a .js file and not a php file. Why don't you describe what you're trying to accomplish?

Reply With Quote
  #3  
Old September 8th, 2003, 01:07 PM
johnn johnn is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: Southern California, USA
Posts: 48 johnn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Thanks. This script is from the article xml content feed revisited, by Michael Harper. It's is in the test.html. I add u and r vaiables to get the stats of the site. What I want to do is get the statitics of one site and store them in a database of another site.

Reply With Quote
  #4  
Old September 8th, 2003, 01:41 PM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Aha. The issue is still that you're trying to write js code in the script invocation, and that won't work as you've got it. You can try something like the following, though:

Code:

<script language="javascript">

document.write("<script language=\"JavaScript\" src=\"http://www.abcd.net/feed.php?r=" + escape(document.referer) + "&u=" + escape(navigator.userAgent)\"></script>\n");

</script>


Use javascript to write inline javascript. Or if your page is in PHP anyway, use PHP to generate the js. There are a couple of syntax errors in your URL, which I've corrected. Namely, you've left off the ampersand before the second parameter, and you haven't closed the quote you opened for the script source. Hope this helps. Incidentally, I'm not certain this'll work -- the inline js may not parse and run on the fly. Maybe it's worth a shot, though.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > Transfering variables to php script


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT