NEED HELP! "php with javascript"

Links for php scripts

Moderators: macek, egami, gesf

holeyh
New php-forum User
New php-forum User
Posts: 2
Joined: Wed Jan 22, 2003 12:56 pm
Location: montreal
Contact:

NEED HELP! "php with javascript"

Postby holeyh » Wed Jan 22, 2003 1:58 pm

Hi,
i'm trying to affect a php variable from a db to a javascript variable and it seems like i don't do the right thing...

Anyone can help me?

Thanks
Patrice
---------------------------


<SCRIPT LANGUAGE=javascript>
<!--
function CompareToList(){

to_select = <? '.$row[Question_Secrete_value ].' ?>;

for(i=0;i<document.form1.QuestionSecrete.length;i++){
strText = document.form1.QuestionSecrete[i].value;
if(to_select==strText){
document.form1.QuestionSecrete.options[i].selected = true;
break;
}
}
}
//-->
</SCRIPT>

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Re: NEED HELP! "php with javascript"

Postby Oleg Butuzov » Wed Jan 29, 2003 1:09 am

Code: Select all

<SCRIPT LANGUAGE=javascript>
<!--
function CompareToList(){

to_select = <?=$row[Question_Secrete_value ];?>;

for(i=0;i<document.form1.QuestionSecrete.length;i++){
strText = document.form1.QuestionSecrete[i].value;
if(to_select==strText){
document.form1.QuestionSecrete.options[i].selected = true;
break;
}
}
}
//-->
</SCRIPT>


Return to “PHP Scripts”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest