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 May 20th, 2001, 07:06 PM
ds99jove ds99jove is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Posts: 37 ds99jove User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 13
Question PHP and Javascript Combined

Hi,

I'm working on a Javascript to update 2 listboxes with values, here's where PHP come in. I use PHP to get the values from a Database, but how can I use Javascript variables in PHP code?
What I'm trying to do looks something like this simplified:

<SCRIPT LANGUAGE="Javascript">
function getPerioder(selection)
{
var ftgID = selection.options[selection.selectedIndex].value;
<?php $result2=mysql_query("SELECT * FROM FtgPerioder WHERE ftgID=ftgID");
$object=mysql_fetch_object($result2);
$name=$object->name;
?>
document.form1.perioder.options[0].text=name;
}
</SCRIPT>


The thing I want to do is:
replace ftgID in
mysql_query("SELECT * FROM FtgPerioder WHERE ID=ftgID");
with the javascript variable

Help Greatly needed!
Many Thanks!
Jonas Versén

Reply With Quote
  #2  
Old May 21st, 2001, 05:41 AM
Niclas Bengtsson Niclas Bengtsson is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2000
Location: Sweden
Posts: 61 Niclas Bengtsson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 32 m 35 sec
Reputation Power: 13
Since PHP is a server-side, it has already done it´s work when the html page is up (Javascript is client-side). So what you have to do is to run the script again with the new value.

//N.B

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > PHP and Javascript Combined

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