JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 1st, 2001, 01:15 AM
Slak Slak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 21 Slak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Slak
JavaScript/PHP interaction problem

I'm having trouble getting data to "echo" within JavaScripts.

Example:
PHP Code:
<td onmouseover="this.style.backgroundColor='#cbddfe';this.style.cursor='hand';" onmouseout="this.style.backgroundColor='#dddddd';" onclick="location.href='./main.php?temp=<? echo $temp; ?>'">Home</td

The variable is not being printed onto the page.

Another example:
PHP Code:
<td align="center"><a onMouseOver="return(updateButton('Home','Home','Active',false))" onMouseOut="return(updateButton('Blank','Home','Inactive',false))" href="./main.php?temp=<? echo $temp; ?>"><img src="./graphics/40/home.gif" name="buttonHome" border="0"></a></td


However, where just a standard link appears, the variable is printed just fine:
<a href="./main.php?temp=<? echo $temp; ?>">Home</a>


So, I can only assume the JavaScripting is causing some sort of trouble with the PHP. Is there anyway way around this? How can I have my variables which the page receives via a query string printed in the URLs of the links to complete those query strings?

Reply With Quote
  #2  
Old October 1st, 2001, 08:05 AM
jdk's Avatar
jdk jdk is offline
phpkid ~~~~~~ :o)
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Nov 2000
Location: NJ, USA
Posts: 2,534 jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level)jdk User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 11 m 11 sec
Reputation Power: 15
Send a message via Yahoo to jdk
nope.

javascript, can not at all trouble PHP. PHP is parsed on server side before javascript can even come to picture.

btw this code you have put up from your php file ??
i think it should work.

jd
__________________
_____________________________
d.k.jariwala (JD)
~ simple thought, simple act ~
I blog @ http://jdk.phpkid.org

Reply With Quote
  #3  
Old October 1st, 2001, 04:22 PM
Keiichi Keiichi is offline
aHVoPw==
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2001
Posts: 1,058 Keiichi User rank is Lance Corporal (50 - 100 Reputation Level)Keiichi User rank is Lance Corporal (50 - 100 Reputation Level)Keiichi User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 15 h 42 m 24 sec
Reputation Power: 14
you mean it's printing exactly this?
<a href="./main.php?temp=<? echo $temp; ?>">Home</a>

make sure php is being parsed by the server for that page. other than that, it should've worked..

just for fact, i like to make short echo's like "<?=$temp?>"
It just looks better.
__________________
Visit my new IIS Tutorial Series!

Reply With Quote
  #4  
Old October 1st, 2001, 08:22 PM
AlexNinjaFighte AlexNinjaFighte is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2001
Location: Pittsburgh PA USA
Posts: 137 AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level)AlexNinjaFighte User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 22 m
Reputation Power: 15
I had similar problems recently. However the solution was in correcting my HTML which had gotten out of whack so the javascript could find its targets.

Reply With Quote
  #5  
Old October 2nd, 2001, 11:06 PM
Slak Slak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2001
Posts: 21 Slak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Slak
jdk is right, it has nothing to do with the java, It can't. I don't know what I was thinking, just deperately trying to find a solution, I guess.

It just so happens that all the places the variable is supposed to be printed happen to be in JavaScripts.

It is just blowing my mind... The page is called with a query that defines the variable. I know it is successfuly received because it uses that variable to inculde it's template. The template itself calls for the variable a few more times, to be printed within the query strings of a few links. It does not appear, the url appears, but the variable is not printed. However The template calls a page which contains all the navigation links. That page should also print the variable into the strings, and it DOES.

That is the confusing part. I can't figure out how the variable is used to incude a page and does. The variable is not recognized on the included page, but IS recognized on the page that it includes.

It is set as a global variable:

<?
global $temp;
?>

And to make matters worse, I have 9 templates so that people can select skins, and on 2 of the 9 skins, everything works fine. I swear there is no difference in how I set up all the templates. I wrote all the PHP on the first template, then copied and pasted it onto the other eight, and the original is one of the ones not working.

It must be some stupid and frustrating simple little error on my part, I'll figure it out sooner or later.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > JavaScript/PHP interaction problem

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap