Re: [PHP] Using javascript with php

2006-02-16 Thread Richard Lynch

getElementByID()


On Wed, February 15, 2006 4:10 pm, Sugrue, Sean wrote:
 To all,

 I have a check box input which I assign an array to the name. I want
 to
 pass the array to a javascript and based on a certain criteria check
 the box. I use the syntax:
 formname.elements['array[]'][index].checked=
 true. It works with IE but since my buddy added an html validator
 to a config file we all use and now the code will not work in Firefox.
 Does anyone out there perform this task differently? Any suggestions?

 Sean

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using javascript with php

2006-02-15 Thread Sugrue, Sean
To all,

I have a check box input which I assign an array to the name. I want to
pass the array to a javascript and based on a certain criteria check
the box. I use the syntax: formname.elements['array[]'][index].checked=
true. It works with IE but since my buddy added an html validator
to a config file we all use and now the code will not work in Firefox.
Does anyone out there perform this task differently? Any suggestions?

Sean

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using javascript with php

2006-02-15 Thread Curt Zirzow
On Wed, Feb 15, 2006 at 05:10:53PM -0500, Sugrue, Sean wrote:
 To all,
 
 I have a check box input which I assign an array to the name. I want to
 pass the array to a javascript and based on a certain criteria check
 the box. I use the syntax: formname.elements['array[]'][index].checked=
 true. It works with IE but since my buddy added an html validator
 to a config file we all use and now the code will not work in Firefox.
 Does anyone out there perform this task differently? Any suggestions?
 
I always assign ID's to my elements and reference them that way.

input name=array[] id=array_item_1 type=checkbox

var element = document.getElementById('array_item_1');
element.checked = true;



-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using javascript function from php

2005-03-11 Thread Richard Lynch
 I am just learning php, and am currently converting some jsp pages to php.
 I used the follwing code in jsp to toggle between two images

Instead of driving yourself nuts with echo and quote and backslash and
semi-colon quote semi-colon, just do like this:

?php
  //PHP code here
?
!-- Look ma!  No PHP --
 SCRIPT type=text/javascript language=javascript
 function toggle(imagename,src1,src2){
  if(document.images  document.images[imagename])
  {
  image1=new Image;
  image1.src=src1;
  if(document.images[imagename].src !=
 image1.src){document.images[imagename].src = image1.src}
  else{document.images[imagename].src=src2}
  }
 }
 /SCRIPT
?php
  //more PHP here
?

The hair you save, may be your own.

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Using javascript function from php

2005-03-10 Thread b
Hi,
I am just learning php, and am currently converting some jsp pages to php.  
I used the follwing code in jsp to toggle between two images

SCRIPT type=text/javascript language=javascript
function toggle(imagename,src1,src2){
if(document.images  document.images[imagename])
{
image1=new Image;
image1.src=src1;
if(document.images[imagename].src !=  
image1.src){document.images[imagename].src = image1.src}
else{document.images[imagename].src=src2}
}
}
/SCRIPT

start code snippet.
out.println(A);
out.println(onclick=\toggle(' + child + image','images/ + type  
+ .jpg','images/ + childimg ');return(false);\);
out.println(img src='images/ + type + .jpg' alt='' name= + child  
+ image/a);
out.println(input type=hidden name= + child +  value=' + childimg  
+ ');
end code snippet...

I have tried many different ways to achieve this in php, but nothing  
works. This is my latest attempt

start code snippet.
print(A href=\javascript:;\ onclick=);
echo \if(document.images  document.images[ . $child . image])\n;
echo 	{\n;
echo 	image1=new Image;\n;
echo 	image1.src=images/$type.jpg;\n;
echo 	if(document.images[ . $child . image].src !=  
image1.src){document.images[ . $child . image].src = image1.src}\n;
echo 	else{document.images[ . $child . image].src=images/$childimg}\n;
echo 	}\n;
echo };\n;
echo return(false);\\n;
print(img src='images/$type.jpg' alt='' name= . $child .  
image\n/a\n);
print(input type=hidden name=$child value='$childimg'\n);
end code snippet.

Could someone please let me know how to do this
Cheers
Barb
--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] using javascript within php

2005-03-07 Thread Ross Hulford
I want to set focus on a text area with javascript if the entry by the user 
is not what I want.

This is what i have so far.
?php

if (isset($submitted){

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
}

}

?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] using javascript within php

2005-03-07 Thread John Nichel
Ross Hulford wrote:
snip
PHP == Server Side
HTML/JavaScript == Client Side
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP] using javascript within php

2005-03-07 Thread Jay Blanchard
[snip]
I want to set focus on a text area with javascript if the entry by the
user 
is not what I want.

if (isset($submitted){

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
}
[/snip]

if(empty($name)) {
$fname_error =  *Please Enter your firstname or initial;
//the code to set focus to the textbox should go here
echo window.document.YOURFORMNAME.name.focus();;
}

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using JavaScript variables in PHP

2003-11-21 Thread Larry_Li
form method=post action=your_php_file.php
input name=id
/form

in your_php_file.php, try

select * from somedatabase where field=$id








Mike Knittel [EMAIL PROTECTED]
11/20/2003 11:45 PM
 
To: [EMAIL PROTECTED]
cc: 
Subject:[PHP] Using JavaScript variables in PHP
 


How does one go about using a JavaScript variable with PHP code.  I have a
function in JavaScript that takes a single input parameter (ID).  I want 
to
use this ID variable as the value on the where clause of a database query.

Example:  select * from somedatabase where field=ID

Can this be done, and if so how?  I have been unable to figure this out.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Using JavaScript variables in PHP

2003-11-20 Thread Mike Knittel
How does one go about using a JavaScript variable with PHP code.  I have a
function in JavaScript that takes a single input parameter (ID).  I want to
use this ID variable as the value on the where clause of a database query.

Example:  select * from somedatabase where field=ID

Can this be done, and if so how?  I have been unable to figure this out.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using JavaScript variables in PHP

2003-11-20 Thread Mike Migurski
How does one go about using a JavaScript variable with PHP code.  I have
a function in JavaScript that takes a single input parameter (ID).  I
want to use this ID variable as the value on the where clause of a
database query.

Example:  select * from somedatabase where field=ID

Can this be done, and if so how?  I have been unable to figure this out.

Not unless you include the javascript variable in a subsequent GET or POST
request to the server - once your browser renders an HTTP response, PHP's
involvement is long finished.

-
michal migurski- contact info and pgp key:
sf/cahttp://mike.teczno.com/contact.html

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Using JavaScript variables in PHP

2003-11-20 Thread John Nichel
Mike Knittel wrote:
How does one go about using a JavaScript variable with PHP code.  I have a
function in JavaScript that takes a single input parameter (ID).  I want to
use this ID variable as the value on the where clause of a database query.
Example:  select * from somedatabase where field=ID

Can this be done, and if so how?  I have been unable to figure this out.

Not unless you send a request to the server (reload the page, go to 
another page, etc.).  php runs server side, JavaScript runs client side.

--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Using Javascript

2002-07-27 Thread Zoltan Konyves

Hello Uma,

Monday, July 22, 2002, 8:09:44 AM, you wrote:


UST Hello,

UST  I need to display a value on the text box during onClick event where the
UST data is fetched from the database..I have given the code like this but it
UST is giving unterminated string constant..


UST input type=text name=text1 onClick=(dd.value=? echo $correct; ?);


UST Can anyone please tell me how to solve this ... 


UST Thanks  Regards,
UST Uma



Hi,

Try to use:
input type=text name=text1
   onClick=dd.value='? echo $correct; ?';

-- 
Best regards,
 Zoltanmailto:[EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Using Javascript

2002-07-21 Thread Uma Shankari T.


Hello,

 I need to display a value on the text box during onClick event where the
data is fetched from the database..I have given the code like this but it
is giving unterminated string constant..


input type=text name=text1 onClick=(dd.value=? echo $correct; ?);


Can anyone please tell me how to solve this ... 


Thanks  Regards,
Uma


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php