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 August 15th, 2000, 12:23 AM
alvaro alvaro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2000
Location: columbia
Posts: 2 alvaro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Hi listers.

I have the next code:

<FORM>
<CENTER><H3>DATABAE </H3></CENTER>
<script language="Javascript">
function go1(form)
{
var tU = new Array();
tU[0]="new_university.phtml?identi='$login'" ;
tU[1]="nuevo_sector.phtml";

location = tU[form.sel_URL.selectedIndex];
}
</script>
&nbsp;&nbsp;
<B>Insertar</B><BR>
<SELECT NAME="sel_URL" onChange="go1(this.form)">
<OPTION Value="new_university.phtml?identi='$login'">University
</Select>
<INPUT TYPE="Button" VALUE="IR" onClick="go1(this.form)" > <!-- via JavaScript -->
</Form>
Before this code I have a variable named $login. When i Ask about this variable before or after javascript thereisnīt problem because have the value. But in the javascript its value is empty. I need send this value to the page new_university.

Thank you

Reply With Quote
  #2  
Old August 15th, 2000, 02:05 PM
danmckay danmckay is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2000
Posts: 7 danmckay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The problem is that JavaScript is not able to access PHP's variables all by itself. You need to go into PHP mode within your javascript and echo/print the variable's value to javascript, like this:

tU[0]="new_university.phtml?identi='<?php echo $login; ?>'" ;

Reply With Quote
  #3  
Old August 15th, 2000, 02:07 PM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 757 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 18 m 32 sec
Reputation Power: 14
try,

tU[0]="new_university.phtml?identi=<? echo $login?>" ;

and elsewhere in yor code, to javascript $login is exactly that $login not whatever it contains.

------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Explanation about problem PHP and javascript

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