RE: [PHP] JavaScript and PHP

2008-05-16 Thread tedd

At 4:01 PM +0100 5/16/08, Ford, Mike wrote:

On 14 May 2008 21:21, tedd advised:


 At 7:31 PM +0100 5/14/08, Mário Gamito wrote:

 Hi,

 I have this HTML/JS page that switches images
 clicking on the radio buttons and call
 template.php with the image ID as parameter:
 http://portulan-online.net/einstein.html

 Now, I need to make it a PHP page, because it is
 going to receive a parameter from the URL that
 calls it and pass it as is to template.php


 Mário:

 The key here to remember is that javascript uses
 ID and php uses NAME for inputs.


That's incorrect.  A form will function 
perfectly well with only name= attributes, and 
no ids, and it's quite possible for JavaScript 
to address the form elements using only the 
names (in fact, it's easier than via the ids as 
there's a short syntax for it!).


Incorrect or not, it works.

Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



RE: [PHP] JavaScript and PHP

2008-05-16 Thread Ford, Mike
On 16 May 2008 16:12, Boyd, Todd M. advised:

>> -Original Message-
> 
> 8< snip!
> 
>> That's incorrect.  A form will function perfectly well with only
name=
>> attributes, and no ids, and it's quite possible for JavaScript to
>> address the form elements using only the names (in fact, it's easier
>> than via the ids as there's a short syntax for it!).
>> 
>> CSS and the DOM, however, use the ids as primary identifier, so use
of
>> either of those may demand the presence of ids.
> 
> 8< snip!
> 
> True, you can access an input named "myInput" in a form named "myForm"
by
> simply writing: 
> 
>   document.myForm.myInput.value = "Hello!";
> 
> BUT... for CSS, it's also quite easy to reference something by name:
> 
>   [name="myElement"]
>   {
>   color: blue;
>   font-size: 10pt;
>   }

Well, true -- hence the qualifiers in "*primary* identifier" and "*may*
demand"!

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] JavaScript and PHP

2008-05-16 Thread Boyd, Todd M.
> -Original Message-

8< snip!

> That's incorrect.  A form will function perfectly well with only name=
> attributes, and no ids, and it's quite possible for JavaScript to
> address the form elements using only the names (in fact, it's easier
> than via the ids as there's a short syntax for it!).
> 
> CSS and the DOM, however, use the ids as primary identifier, so use of
> either of those may demand the presence of ids.

8< snip!

True, you can access an input named "myInput" in a form named "myForm"
by simply writing:

document.myForm.myInput.value = "Hello!";

BUT... for CSS, it's also quite easy to reference something by name:

[name="myElement"]
{
color: blue;
font-size: 10pt;
}


Todd Boyd
Web Programmer

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



RE: [PHP] JavaScript and PHP

2008-05-16 Thread Ford, Mike
On 14 May 2008 21:21, tedd advised:

> At 7:31 PM +0100 5/14/08, Mário Gamito wrote:
>> Hi,
>> 
>> I have this HTML/JS page that switches images
>> clicking on the radio buttons and call
>> template.php with the image ID as parameter:
>> http://portulan-online.net/einstein.html
>> 
>> Now, I need to make it a PHP page, because it is
>> going to receive a parameter from the URL that
>> calls it and pass it as is to template.php
> 
> Mário:
> 
> The key here to remember is that javascript uses
> ID and php uses NAME for inputs.

That's incorrect.  A form will function perfectly well with only name= 
attributes, and no ids, and it's quite possible for JavaScript to address the 
form elements using only the names (in fact, it's easier than via the ids as 
there's a short syntax for it!).

CSS and the DOM, however, use the ids as primary identifier, so use of either 
of those may demand the presence of ids.

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] JavaScript and PHP

2008-05-14 Thread tedd

At 7:31 PM +0100 5/14/08, Mário Gamito wrote:

Hi,

I have this HTML/JS page that switches images 
clicking on the radio buttons and call 
template.php with the image ID as parameter: 
http://portulan-online.net/einstein.html


Now, I need to make it a PHP page, because it is 
going to receive a parameter from the URL that 
calls it and pass it as is to template.php


Mário:

The key here to remember is that javascript uses 
ID and php uses NAME for inputs. So, if you put 
your variables in that form and they will work 
between javascript and php. Such as:


onclick="javascript:GetImage(this);">Einstein 2


Note the change of "this" in your js call -- you 
can do that and not have to provide the number.


Also put in an action="whatever" into your form 
and collect the selection via $_POST['rad'];


That will do what you want.

Cheers,

tedd


--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] JavaScript and PHP

2008-05-14 Thread Dan Joseph
On Wed, May 14, 2008 at 2:31 PM, Mário Gamito <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I have this HTML/JS page that switches images clicking on the radio buttons
> and call template.php with the image ID as parameter:
> http://portulan-online.net/einstein.html
>
> Now, I need to make it a PHP page, because it is going to receive a
> parameter from the URL that calls it and pass it as is to template.php
>
>
> So, einstein.php will be called with a parameter (satellite):
> http://portulan-online.net/einstein.php?satellite=123
>
> After that, in einstein.php, I do:
>
> $satellite = $_REQUEST['satellite'];
>
> Next thing, I need the action in the JavaScript to be, for example:
> http://portulan-online.net/template.php?id=3&satellite=123
>
> What I don't know is how to mix the "PHP variable" satellite with the image
> ID here:
> document.getElementById('image1').src = "
> http://portulan-online.net/einstein-"; + ID + ".png";
>
> I've tried putting einstein.php all inside an "echo", but the radio buttons
> and the submit button stopped working.
>
> Does anyone knows how to do this ?
>
> Any help would be appreciated.
>
> Warm Regards,
> Mário Gamito
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
document.getElementById('image1').src = "
http://portulan-online.net/einstein-"; +  +
".png";

You could do that.  Also, I'd suggest using $_GET instead of $_REQUEST.
Request works,b ut it is very broad.  $_GET is more specific/secure.


-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


[PHP] JavaScript and PHP

2008-05-14 Thread Mário Gamito

Hi,

I have this HTML/JS page that switches images clicking on the radio 
buttons and call template.php with the image ID as parameter: 
http://portulan-online.net/einstein.html


Now, I need to make it a PHP page, because it is going to receive a 
parameter from the URL that calls it and pass it as is to template.php



So, einstein.php will be called with a parameter (satellite): 
http://portulan-online.net/einstein.php?satellite=123


After that, in einstein.php, I do:

$satellite = $_REQUEST['satellite'];

Next thing, I need the action in the JavaScript to be, for example:
http://portulan-online.net/template.php?id=3&satellite=123

What I don't know is how to mix the "PHP variable" satellite with the 
image ID here:
document.getElementById('image1').src = 
"http://portulan-online.net/einstein-"; + ID + ".png";


I've tried putting einstein.php all inside an "echo", but the radio 
buttons and the submit button stopped working.


Does anyone knows how to do this ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] Javascript and PHP interaction

2007-03-12 Thread Richard Lynch
What you *COULD* do is this:

Use .htaccess to force your .css files to *really* be PHP files:


  ForceType application/x-httpd-php


[NOTE: Depending on your server configuration, the
application/x-httpd-php part could be *ANYTHING* the sysadmin felt was
appropriate...]

Inside your CSS, you now have the full-blown power of PHP to output
whatever you think is "right" for the CSS.

But you'll need to tell the browser that this *IS* CSS output, so
you'll need:

at the very tip-top.

Note that browsers can cache the CSS, so you'll want to add more
headers to stop that, probably, or have a random value in the LINK tag
in your HTML document.

On Thu, March 8, 2007 3:14 am, Alain Roger wrote:
> Hi,
>
> I would like to know if there is a way how PHP code can extract from
> ElementID some property values.
>
> for example, i have the following PHP page :
>
>  print "my main div";
> $new_Width = somefunction();
> print " style='width:".$new_Width."px;'>my child div";
> ?>
> in my CSS file (which is link to my HTML page), i have :
>
> .maindiv
> {
>  width : 300px;
>  height : 400px;
>  background-color : #EEBBEE;
> }
> .childdiv
> {
>  background-color : #BB;
> }
>
> my PHP code should be able :
> - to extract the width of id_maindiv ID (so to get 300px) and to
> reduce it
> by 50px
>
> the problem is that i tried with Javascript and if the property
> (style:width) is not define DIRECTLY to HTML code (but only in CSS
> file),
> the javascript is not able to return the value (but only 'undefined').
> So i would like to know if PHP could help me in this way ?
>
> thanks a lot,
>
> --
> Alain
> 
> Windows XP SP2
> PostgreSQL 8.1.4
> Apache 2.0.58
> PHP 5
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Javascript and PHP interaction

2007-03-08 Thread Németh Zoltán
2007. 03. 8, csütörtök keltezéssel 09.14-kor Alain Roger ezt írta:
> Hi,
> 
> I would like to know if there is a way how PHP code can extract from
> ElementID some property values.
> 
> for example, i have the following PHP page :
> 
>  print "my main div";
> $new_Width = somefunction();
> print " style='width:".$new_Width."px;'>my child div";
> ?>
> in my CSS file (which is link to my HTML page), i have :
> 
> .maindiv
> {
>  width : 300px;
>  height : 400px;
>  background-color : #EEBBEE;
> }
> .childdiv
> {
>  background-color : #BB;
> }
> 
> my PHP code should be able :
> - to extract the width of id_maindiv ID (so to get 300px) and to reduce it
> by 50px
> 
> the problem is that i tried with Javascript and if the property
> (style:width) is not define DIRECTLY to HTML code (but only in CSS file),
> the javascript is not able to return the value (but only 'undefined').
> So i would like to know if PHP could help me in this way ?

I think you can not do it with PHP.
But you can do it with javascript. you have to read the offsetWidth
property of the object, then set it's style.width like

if (document.getElementById('whatever').offsetWidth > 300) {
document.getElementById('whatever').style.width = 300;
}

hope that helps
Zoltán Németh

> 
> thanks a lot,
> 

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



[PHP] Javascript and PHP interaction

2007-03-08 Thread Alain Roger

Hi,

I would like to know if there is a way how PHP code can extract from
ElementID some property values.

for example, i have the following PHP page :

my main div";
$new_Width = somefunction();
print "my child div";
?>
in my CSS file (which is link to my HTML page), i have :

.maindiv
{
width : 300px;
height : 400px;
background-color : #EEBBEE;
}
.childdiv
{
background-color : #BB;
}

my PHP code should be able :
- to extract the width of id_maindiv ID (so to get 300px) and to reduce it
by 50px

the problem is that i tried with Javascript and if the property
(style:width) is not define DIRECTLY to HTML code (but only in CSS file),
the javascript is not able to return the value (but only 'undefined').
So i would like to know if PHP could help me in this way ?

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


RE: [PHP] Javascript and php

2004-11-07 Thread Reinhart Viane
Thank you very much,

After some small adjustements to make it work with the rest of the
javascript it works like a charm!!

Have a nice Sunday :)

Greetings,
Reinhart

-Original Message-
From: Bruno B B Magalhães [mailto:[EMAIL PROTECTED] 
Sent: zondag 7 november 2004 12:33
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Javascript and php


Reinhart,


picture_url.'"';

if($i <= mysql_num_rows($result)-2)
{
echo ',';
}
}
?>

Here is how I do in my developments.

Regards,
Bruno B B Magalhães

On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote:

> Hey all,
> Hope some of you also work on sundays :)
>
> I have a little javascript which displays a images (with previous /
> next
> thing)
> Now, i populate the javascript array with an php array:
>
> 
>
> <!-- Begin
> NewImg = new Array (
> <?php
> while($row = mysql_fetch_object($result)){
> echo "\"".$row->picture_url."\",";
> }
> ?>
> "../pictures/7_stripper3.jpg",
> "../pictures/7_stripper2.jpg"
> );
> var ImgNum = 0;
> var ImgLength = NewImg.length - 1;
> ...
> 
>
> As you can see i echo the url of the picture.
> After each picture url there needs to be a ','
> But not after the last picture.
> At this moment all pictures have the ',' after there url, even the 
> last one. Any way to determine if the url is the url of the last 
> picture and thus not printing a ',' behind that last one?
>
> Thx in advance,
>
> Reinhart
>
>   _
>
> Reinhart Viane
>  <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED]
> Domos || D-Studio
> Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01
> --
> fax +32 15 43 25 26
>
>
> STRICTLY PERSONAL AND CONFIDENTIAL
> This message may contain confidential and proprietary material for the

> sole use of the intended recipient.  Any review or distribution by 
> others is strictly prohibited.
> If you are not the intended
> recipient please contact the sender and delete all copies.
>
>

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

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



Re: [PHP] Javascript and php

2004-11-07 Thread Bruno B B Magalhães
Reinhart,
picture_url.'"';

if($i <= mysql_num_rows($result)-2)
{
echo ',';
}
}
?>
Here is how I do in my developments.
Regards,
Bruno B B Magalhães
On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote:
Hey all,
Hope some of you also work on sundays :)
I have a little javascript which displays a images (with previous / 
next
thing)
Now, i populate the javascript array with an php array:



< /head >

...and so on.



Jordan wrote:

> Hey all,
> 
> Just a quick question...how would you pass a PHP variable to a JavaScript
> function?
> 
> -Jordan
> 
> 
> 
> 



-- 
Sliante,
Richard S. Crawford

mailto:[EMAIL PROTECTED] 
http://www.mossroot.com
AIM:  Buffalo2K   ICQ: 11646404  Yahoo!: rscrawford
MSN:  [EMAIL PROTECTED]

"When you have lost the ability to laugh at yourself, you have lost the 
ability to think straight." --Clarence Darrow

"Push the button, Max!"



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] JavaScript and PHP

2001-12-09 Thread Jordan

Hey all,

Just a quick question...how would you pass a PHP variable to a JavaScript
function?

-Jordan



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Javascript and Php

2001-03-02 Thread Christian Reiniger

On Thursday 01 March 2001 13:19, you wrote:

> I'd like to include an inc file once a button id cliked!

You can only request a new page. Period.
PHP runs on the server, button clicks are evaluated on the client 
(browser).

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

The use of COBOL cripples the mind; its teaching should, therefore,
be regarded as a criminal offence.

- Edsger W. Dijkstra

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Javascript and Php

2001-03-01 Thread kaab kaoutar

Hi!
I'd like to include an inc file once a button id cliked!
I tried calling that function:
function more()
{
;
// var f=;
document.form1.action="formhtl_rd.html";document.form1.submit();
}

but it fails!
Any idea
Thanks




_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] javascript and php

2001-01-16 Thread Jørg V . Bryne

In general:
We made a script which did this, however a bit limited because of the
client/server-problems mentioned.
The script is part of a registration-form, and pick out a city based on the
zip entered. We didn't want the list of zipcodes and cities in JS since it
would be quite huge.

Don't remember the excacts but in general: (simplified model)

 


Fetch() is a function that opens a new pop-up window at 50x50px, and set the
url-property of this window using JS (ex:)
 var strURL = "find_city.php?zip=" + document.oFrm.zip.value;

The find_city.php script recieves the zip in a get-var, and can connect to
mysql and retrieve the city etc. and closes itself.

find_city then outputs JS (ex):

 opener.document.oFrm.city.value = "$the_right_city";
 self.close();


The "drawbacks" here is a window flashing a short second or so...
You can make this thing run queries or whatever...

Wrote the above from memory, so the syntax might be a bit of, but the flow
is the same.

have a nice day!
-Jørg V. Bryne
- Original Message -
From: "Patrice ROTH" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 10:04 AM
Subject: [PHP] javascript and php


> It is easy to generate javascript through php,but how to call php through
> javascript.
> In fact, I'd like to update some form fields according to events on other
> fields. I can do this using javascript, but the values should be readed in
a
> MySql database.
>
> Thank's
> Patrice
>
- Original Message -
From: "Soeren Staun-Pedersen" <[EMAIL PROTECTED]>
To: "Patrice ROTH" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, January 16, 2001 10:08 AM
Subject: Re: [PHP] javascript and php


> > It is easy to generate javascript through php,but how to call php
through
> > javascript.
> > In fact, I'd like to update some form fields according to events on
other
> > fields. I can do this using javascript, but the values should be readed
in a
> > MySql database.
>
> You're in a serverside, clientside problem. You want the client to execute
> the PHP code, which it cannot. If you want to update the form fields with
> some other data, you have to provide the page you sent to the client with
> all the needed data beforehand.
>
> Regards,
>
> Soeren Staun-Pedersen - [EMAIL PROTECTED]
> --
> "The internet is full, beat it"
> - Me.
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] javascript and php

2001-01-16 Thread Soeren Staun-Pedersen

> It is easy to generate javascript through php,but how to call php through
> javascript.
> In fact, I'd like to update some form fields according to events on other
> fields. I can do this using javascript, but the values should be readed in a
> MySql database.

You're in a serverside, clientside problem. You want the client to execute
the PHP code, which it cannot. If you want to update the form fields with
some other data, you have to provide the page you sent to the client with
all the needed data beforehand.

Regards,

Soeren Staun-Pedersen - [EMAIL PROTECTED]
--
"The internet is full, beat it"
- Me.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] javascript and php

2001-01-16 Thread Patrice ROTH

It is easy to generate javascript through php,but how to call php through
javascript.
In fact, I'd like to update some form fields according to events on other
fields. I can do this using javascript, but the values should be readed in a
MySql database.

Thank's
Patrice



Re: [PHP] JavaScript and PHP ... are they at all the same?

2001-01-10 Thread Marcelo Gulin

Hi!

  yes, you can escape like in php o c.

regards
Marcelo Gulin


Brandon Orther escribió:
> 
> Hello,
> 
> I am making a PHP script that makes a JavaScript.  Is there a way in java to
> escape a character like in php. (in php you use "\")
> 
> Thank you,
> 
> 
> Brandon Orther
> WebIntellects Design/Development Manager
> [EMAIL PROTECTED]
> 800-994-6364
> www.webintellects.com
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] JavaScript and PHP ... are they at all the same?

2001-01-10 Thread Brandon Orther

Hello,

I am making a PHP script that makes a JavaScript.  Is there a way in java to
escape a character like in php. (in php you use "\")

Thank you,


Brandon Orther
WebIntellects Design/Development Manager
[EMAIL PROTECTED]
800-994-6364
www.webintellects.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]