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-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 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 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-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=3satellite=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-; + ?php echo $_GET['satellite']; ? +
.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.


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:


input type=radio name=rad id=rad value=2 
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 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:

Files ~.css
  ForceType application/x-httpd-php
/Files

[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:
?php
   header(Content-type: text/css);
?
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 :

 ?php
 print div class='maindiv' id='id_maindiv'my main div/div;
 $new_Width = somefunction();
 print div class='childdiv' id='id_childdiv'
 style='width:.$new_Width.px;'my child div/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 :
 
 ?php
 print div class='maindiv' id='id_maindiv'my main div/div;
 $new_Width = somefunction();
 print div class='childdiv' id='id_childdiv'
 style='width:.$new_Width.px;'my child div/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



Re: [PHP] javascript in php page to use window.open()

2006-01-12 Thread Rodolfo Andrade
Hi Olga,

Your Javascript window.open() is missing one argument, the name of the
pop-up window:

window.open(\add.html\,\MyWindowName\,\resizable=no,width=400,height=20
0\);

Best Regards,
Rodolfo Andrade

- Original Message - 
From: Olga Urban
To: php-general@lists.php.net
Sent: Thursday, January 12, 2006 2:51 AM
Subject: [PHP] javascript in php page to use window.open()


Hi everyone,

I am trying to open a new window after a successful function call (I
don't want to use a href. and onclick). Here's what I have, but for
some reason, in IE the new window does not open (I have popup blockers
disabled). It opens in Mozilla, but with the wrong size. What am I doing
wrong here?

if (insert($lname, $fname, $course, $date, $media1,
$media2))
{
echo script type=\text/javascript\\n;
echo 
window.open(\add.html\,\resizable=no,width=400,height=200\);;
echo /script\n\n;
}
else
echo Error adding a record.;



Thanks.

Olga

-- 
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 Jordi Canals
On Sun, 7 Nov 2004 11:44:33 +0100, Reinhart Viane [EMAIL PROTECTED] wrote:

 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:
 
 SCRIPT LANGUAGE=JavaScript
 
 !-- 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;
 ...
 /script
 
 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?
 

Yes ... some work on sunday ;), at least to read the list

I took no much time to find out a solution for your problem, but a
possible question could be:

?php
$list = array()
while($row = mysql_fetch_object($result)){
$list[] = ''. $row-picture_url .'';
}
echo implode(',', $list);
}
?

Another solution :

 ?php
$string = ''
while($row = mysql_fetch_object($result)){
  $string .= \.$row-picture_url.\,;
}
$string = substr($string, 0, strlen($string - 1);
?

I have no tested the solutions, so could be some sintax error. But to
give you a couple of examples, hope that helps

Jordi

-- 
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,
?php
for($i = 0; $i  mysql_num_rows($result)-1; $i++)
{
$row = mysql_fetch_object($result);

echo ''.$row-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:

SCRIPT LANGUAGE=JavaScript
!-- 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;
...
/script
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


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,


?php
for($i = 0; $i  mysql_num_rows($result)-1; $i++)
{
$row = mysql_fetch_object($result);

echo ''.$row-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:

 SCRIPT LANGUAGE=JavaScript

 !-- 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;
 ...
 /script

 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 again

2002-11-13 Thread Marek Kilimajer
php doesn't understand javascript, php executes on the server and 
javascript on the client side.

Edward Peloke wrote:

I have some javascript that by itself, runs fine in a php file but, when I
enclose it in php...

?
if (!variable)
{
?

---insert java here

?
}
?

Then is does not work...is there a trick to this?  Can this not be done?

Thanks,
Eddie


 



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




RE: [PHP] javascript and php again

2002-11-13 Thread Edward Peloke
so there is no way to use javascript and php together?  If not, can php do
some of the cool things that javascript does?  The main thing I am looking
for is a somthing like this:

http://www.dynamicdrive.com/dynamicindex1/popit.htm  but I want the options
built from the db by mysql.

Thanks,
Eddie

-Original Message-
From: Marek Kilimajer [mailto:kilimajer;webglobe.sk]
Sent: Wednesday, November 13, 2002 2:43 PM
To: PHP
Subject: Re: [PHP] javascript and php again


php doesn't understand javascript, php executes on the server and
javascript on the client side.

Edward Peloke wrote:

I have some javascript that by itself, runs fine in a php file but, when I
enclose it in php...

?
if (!variable)
{
?

---insert java here

?
}
?

Then is does not work...is there a trick to this?  Can this not be done?

Thanks,
Eddie






--
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 again

2002-11-13 Thread Chris Boget
 so there is no way to use javascript and php together?  

No, not really.  Not in the way you are hoping.

 If not, can php do some of the cool things that javascript does?  The main 
 thing I am looking for is a somthing like this:
 http://www.dynamicdrive.com/dynamicindex1/popit.htm  but I want the options
 built from the db by mysql.

Go to that page.
View the source.
PHP can output all of that data that you see.
Take everything else you know about PHP and db access and apply it to 
that concept.
 
Chris


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




Re: [PHP] Javascript and PHP

2002-11-06 Thread Chris Hewitt
[EMAIL PROTECTED] wrote:


Well the question is: i want to know how can i make to insert into 
the $_GET or $_POST arrays, an entry with a value from javascript.

All the php processing (on the server) is complete before the javascript 
processing (on the client) commences, so you would need to submit to a 
new location with JS giving parameters in the url. These would then 
appear in the $_GET array for the location you submit to.

HTH
Chris


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



Re: [PHP] Javascript and PHP

2002-11-06 Thread Tom Rogers
Hi,

Wednesday, November 6, 2002, 2:52:31 AM, you wrote:
vaue Hi. I'm not sure if is here where i have to ask this, but, if it's 
vaue not i hope you say to me :D.

vaue Well the question is: i want to know how can i make to insert into 
vaue the $_GET or $_POST arrays, an entry with a value from javascript.

vaue Thanks

This is a post method:

script language=JavaScript
function doit(){
  testval = Hello;
  document.form1.result.value = testval;
  document.form1.submit();
}
/script

form name=form1 action=?echo $_SERVER['PHP_SELF']? method=post
input type=hidden name=result
input type=button value=Submit onclick=doit();
/form

should end up with $_POST['result'] = Hello
-- 
regards,
Tom


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




Re: [PHP] Javascript to PHP?

2002-07-01 Thread Erik Price


On Saturday, June 29, 2002, at 03:13  PM, Jed Verity wrote:

 I can't find any information on passing JavaScript variables to PHP on 
 the
 same page (i.e. not through the POST information of a submitted form). 
 Is
 this because it's not possible?

 To take the load off the server, I'm trying to do a bunch of string
 manipulations and loops in JavaScript and then hand that info off to PHP
 once it's done.

How will you communicate with PHP without submitting an HTTP request of 
some sort?  So, really, you will need to submit -something-, though it 
could be GET data, POST data, or COOKIE data.

You can't have JavaScript talk to PHP within the same page since the 
webserver/PHP forgets all information related to that page as soon as 
it shoots it to the user-agent.

I'm assuming you know how to use JavaScript to set a cookie, and/or make 
a new request with GET or POST data attached.  If not, let me know.


Erik






Erik Price
Web Developer Temp
Media Lab, H.H. Brown
[EMAIL PROTECTED]


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




Re: [PHP] Javascript to PHP?

2002-07-01 Thread Jed Verity

Thanks for the response, Erik! I think I will try passing the data in a
cookie to a hidden frame, refreshing the frame, and then reading the data
back. Many thanks to all for the suggestions!

Cheers,
Jed

I liked it when Erik Price wrote this to me:

 
 On Saturday, June 29, 2002, at 03:13  PM, Jed Verity wrote:
 
 I can't find any information on passing JavaScript variables to PHP on
 the
 same page (i.e. not through the POST information of a submitted form).
 Is
 this because it's not possible?
 
 To take the load off the server, I'm trying to do a bunch of string
 manipulations and loops in JavaScript and then hand that info off to PHP
 once it's done.
 
 How will you communicate with PHP without submitting an HTTP request of
 some sort?  So, really, you will need to submit -something-, though it
 could be GET data, POST data, or COOKIE data.
 
 You can't have JavaScript talk to PHP within the same page since the
 webserver/PHP forgets all information related to that page as soon as
 it shoots it to the user-agent.
 
 I'm assuming you know how to use JavaScript to set a cookie, and/or make
 a new request with GET or POST data attached.  If not, let me know.
 
 
 Erik
 
 
 
 
 
 
 Erik Price
 Web Developer Temp
 Media Lab, H.H. Brown
 [EMAIL PROTECTED]
 
 


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




RE: [PHP] Javascript to PHP?

2002-06-29 Thread John Holmes

Not possible. You must refresh the page to send something back to PHP.
Only workaround is using a hidden frame or layer and refreshing that...

---John Holmes...

 -Original Message-
 From: Jed Verity [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, June 29, 2002 3:14 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Javascript to PHP?
 
 Hello, Folks,
 
 My apologies if this has been asked a thousand times. I've just joined
the
 list.
 
 I can't find any information on passing JavaScript variables to PHP on
the
 same page (i.e. not through the POST information of a submitted form).
Is
 this because it's not possible?
 
 To take the load off the server, I'm trying to do a bunch of string
 manipulations and loops in JavaScript and then hand that info off to
PHP
 once it's done.
 
 Any insight is appreciated! Thanks,
 Jed
 
 
 --
 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 to PHP?

2002-06-29 Thread Pushkar Pradhan

I've done this stuff recently. I need to pass whole arrays betn. php and
Javascript (2-way), here is some code:

// PHP var. to JS
function arrFromStr (str2convert) {  // make an array from string
   arr = new Array();
   var posOfQt1   = str2convert.indexOf('\');
   var posOfQt2   = str2convert.indexOf('\', posOfQt1+1);
   i = 0;
   while(posOfQt1 != -1) {
  arr[i] = str2convert.substring(posOfQt1+1, posOfQt2);
  i++;
  posOfQt1 = posOfQt2;
  posOfQt1   = str2convert.indexOf('\', posOfQt1+1);
  posOfQt2   = str2convert.indexOf('\', posOfQt1+1);
   }
   return arr;
}
Call this function like this:
layerDesStr  = '?=serialize($layerDes[0])?';
layerDes[0]  = arrFromStr(layerDesStr);

In case you have a variable don't serialize, just do
myJSvar = ?=$myPHPvar?;
JS variables can be sent to PHP by including them in html forms, nothing
special about it.
 Hello, Folks,

 My apologies if this has been asked a thousand times. I've just joined the
 list.

 I can't find any information on passing JavaScript variables to PHP on the
 same page (i.e. not through the POST information of a submitted form). Is
 this because it's not possible?

 To take the load off the server, I'm trying to do a bunch of string
 manipulations and loops in JavaScript and then hand that info off to PHP
 once it's done.

 Any insight is appreciated! Thanks,
 Jed


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


-Pushkar S. Pradhan


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




Re: [PHP] Javascript to PHP?

2002-06-29 Thread Chris Shiflett

Jed Verity wrote:

I can't find any information on passing JavaScript variables to PHP on the
same page (i.e. not through the POST information of a submitted form). Is
this because it's not possible?

Basically, this is not possible.

A common area of confusion to those new to Web programming is the 
distinction between client-side and server-side code. PHP is an example 
of a server-side scripting language, while JavaScript is client-side. To 
PHP, anything that is not PHP is simply output. It doesn't matter if the 
output is HTML, JavaScript, XML, an image, etc. - it's all not PHP.

When a user requests a PHP script, the PHP part of the script is 
executed prior to the output being sent to the client. Remember, the 
output may contain JavaScript. Once the output reaches the browser, the 
browser will attempt to render the HTML, execute the JavaScript, and 
whatever else is appropriate. So, to get back to your question, you are 
wanting to know how to have the browser (which is executing the 
JavaScript) be able to send a JavaScript variable to PHP (which could be 
thousands of miles away on whatever Web server the page was obtained 
from) on the same page, which means you want to be able to do this 
without communicating back to the Web server.

So, your question can be summarized into:

How can my browser send data back to the Web server without any further 
communication with the Web server?

Hopefully that explains how it is impossible.

The terms server-side and client-side are ignored by most people, 
understandably, because this industry is littered with useless terms 
that do little to describe what is really happening (in the case of Web 
services, the term is actually misleading in my opinion). However, 
these terms are very descriptive, and once you can begin to understand 
which code is executed on the server-side (by the Web server prior to 
sending the response to the Web client) and which code is executed on 
the client-side (by the Web client after receiving the response from the 
Web server), all of these types of questions will make more sense to you.

Hope that gives a good description of the difference and can help you 
solve whatever problem you're currently working on.

Chris


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




RE: [PHP] Javascript to PHP?

2002-06-29 Thread David Freeman


  My apologies if this has been asked a thousand times. I've 
  just joined the list.

I has, but you get that...

  I can't find any information on passing JavaScript variables 
  to PHP on the same page (i.e. not through the POST information of a 
  submitted form). Is this because it's not possible?

Short answer is no.  PHP is server-side, Javascript is client-side.  You
can get variables from php to javascript when your php generates the
page to be sent to the browser but you can only get variables back from
php when you use browser to server communications (that's usually a form
- be it get or post method, or a cookie).

  To take the load off the server, I'm trying to do a bunch of string
  manipulations and loops in JavaScript and then hand that 
  info off to PHP once it's done.

You'll need to create all the javascript from you php page as it
generates and then wait for it all to be done client-side and submitted
back to the server.

CYA, Dave




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




RE: [PHP] Javascript to PHP?

2002-06-29 Thread Mark Charette

Or setting a cookie in JavaScript. It will be transmitted on the next page
request.

-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 29, 2002 3:30 PM
To: 'Jed Verity'; [EMAIL PROTECTED]
Subject: RE: [PHP] Javascript to PHP?


Not possible. You must refresh the page to send something back to PHP.
Only workaround is using a hidden frame or layer and refreshing that...



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




Re: [PHP] Javascript to PHP?

2002-06-29 Thread Jed Verity

Hello, Chris,

Many thanks for the thorough description. It does make sense, of course...I
was just hoping that there was some kind of funky loophole that small brains
like mine couldn't comprehend.

Thanks again!
Jed

I liked it when Chris Shiflett wrote this to me:

 Jed Verity wrote:
 
 I can't find any information on passing JavaScript variables to PHP on the
 same page (i.e. not through the POST information of a submitted form). Is
 this because it's not possible?
 
 Basically, this is not possible.
 
 A common area of confusion to those new to Web programming is the
 distinction between client-side and server-side code. PHP is an example
 of a server-side scripting language, while JavaScript is client-side. To
 PHP, anything that is not PHP is simply output. It doesn't matter if the
 output is HTML, JavaScript, XML, an image, etc. - it's all not PHP.
 
 When a user requests a PHP script, the PHP part of the script is
 executed prior to the output being sent to the client. Remember, the
 output may contain JavaScript. Once the output reaches the browser, the
 browser will attempt to render the HTML, execute the JavaScript, and
 whatever else is appropriate. So, to get back to your question, you are
 wanting to know how to have the browser (which is executing the
 JavaScript) be able to send a JavaScript variable to PHP (which could be
 thousands of miles away on whatever Web server the page was obtained
 from) on the same page, which means you want to be able to do this
 without communicating back to the Web server.
 
 So, your question can be summarized into:
 
 How can my browser send data back to the Web server without any further
 communication with the Web server?
 
 Hopefully that explains how it is impossible.
 
 The terms server-side and client-side are ignored by most people,
 understandably, because this industry is littered with useless terms
 that do little to describe what is really happening (in the case of Web
 services, the term is actually misleading in my opinion). However,
 these terms are very descriptive, and once you can begin to understand
 which code is executed on the server-side (by the Web server prior to
 sending the response to the Web client) and which code is executed on
 the client-side (by the Web client after receiving the response from the
 Web server), all of these types of questions will make more sense to you.
 
 Hope that gives a good description of the difference and can help you
 solve whatever problem you're currently working on.
 
 Chris
 
 


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




RE: [PHP] JavaScript to PHP?

2002-06-29 Thread Bruce Karstedt

You might be able to pass them as a cookie.

Bruce Karstedt
President
Technology Consulting Associates, Ltd.
Tel: 847-735-9488
Fax: 847-735-9474


-Original Message-
From: Jed Verity [mailto:[EMAIL PROTECTED]]
Sent: Saturday, June 29, 2002 2:59 PM
To: Chris Shiflett
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Javascript to PHP?
Importance: Low


Hello, Chris,

Many thanks for the thorough description. It does make sense, of course...I
was just hoping that there was some kind of funky loophole that small brains
like mine couldn't comprehend.

Thanks again!
Jed

I liked it when Chris Shiflett wrote this to me:

 Jed Verity wrote:

 I can't find any information on passing JavaScript variables to PHP on
the
 same page (i.e. not through the POST information of a submitted form). Is
 this because it's not possible?

 Basically, this is not possible.

 A common area of confusion to those new to Web programming is the
 distinction between client-side and server-side code. PHP is an example
 of a server-side scripting language, while JavaScript is client-side. To
 PHP, anything that is not PHP is simply output. It doesn't matter if the
 output is HTML, JavaScript, XML, an image, etc. - it's all not PHP.

 When a user requests a PHP script, the PHP part of the script is
 executed prior to the output being sent to the client. Remember, the
 output may contain JavaScript. Once the output reaches the browser, the
 browser will attempt to render the HTML, execute the JavaScript, and
 whatever else is appropriate. So, to get back to your question, you are
 wanting to know how to have the browser (which is executing the
 JavaScript) be able to send a JavaScript variable to PHP (which could be
 thousands of miles away on whatever Web server the page was obtained
 from) on the same page, which means you want to be able to do this
 without communicating back to the Web server.

 So, your question can be summarized into:

 How can my browser send data back to the Web server without any further
 communication with the Web server?

 Hopefully that explains how it is impossible.

 The terms server-side and client-side are ignored by most people,
 understandably, because this industry is littered with useless terms
 that do little to describe what is really happening (in the case of Web
 services, the term is actually misleading in my opinion). However,
 these terms are very descriptive, and once you can begin to understand
 which code is executed on the server-side (by the Web server prior to
 sending the response to the Web client) and which code is executed on
 the client-side (by the Web client after receiving the response from the
 Web server), all of these types of questions will make more sense to you.

 Hope that gives a good description of the difference and can help you
 solve whatever problem you're currently working on.

 Chris




--
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 to PHP?

2002-06-29 Thread Mark

On Sat, 29 Jun 2002 16:58:50 -0300, Jed Verity wrote:
Hello, Chris,

Many thanks for the thorough description. It does make sense, of
course...I
was just hoping that there was some kind of funky loophole that
small brains
like mine couldn't comprehend.

well if it's one-way only communication, you could load an image in
javascript that is really a php page. that way you can send
information to a php script without the browser reloading. there's
probably other ways that a javascript guru could come up with (maybe
loading content into an invisible layer??) this isn't the best place
to be asking a javascript question tho.

hth.
- Mark


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




RE: [PHP] javascript and PHP

2002-04-29 Thread Cal Evans

since php runs on the server, not on the client, you have to pass the value
of data back to the server.   Normally, this is done via a GET or a POST
from a form or by building a URL and using javascript to load it. (i.e.
document.location = 'http://myserver.com/mypage.php?data=Hello%20World';)

Then your PHP script can execute and see the value of $_GET['data']

HTH,
Cal

*
* Cal Evans
* Journeyman Programmer
* Techno-Mage
* http://www.calevans.com
*


-Original Message-
From: Steve Buehler [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 29, 2002 10:30 AM
To: [EMAIL PROTECTED]
Subject: [PHP] javascript and PHP


Does anybody know of a good/short tutorial about passing variables from
JavaScript to/from PHP?  For example, how to do the following:

html
head
SCRIPT LANGUAGE=JavaScript
data = hello world;
/script
/head
body
?
echo $databr;
?
/body
/html

The above might at least give me a clue.  Just a note.  I really know
nothing to speak of about JavaScript.

Thanks in Advance
Steve


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




Re: [PHP] javascript and PHP

2002-04-29 Thread 1LT John W. Holmes

All you can do is use PHP to print out Javascript code.

?
$data = hello world;
?
script language=javascript
var something;
something = '?=$data?';
/script

etc...It's no different than using PHP to print out HTML code.

Now, if you want to get that Javascript variable something sent back to
PHP, you have to assign it to a form element or tack it onto a URL.

---John Holmes...

- Original Message -
From: Steve Buehler [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 29, 2002 11:29 AM
Subject: [PHP] javascript and PHP


 Does anybody know of a good/short tutorial about passing variables from
 JavaScript to/from PHP?  For example, how to do the following:

 html
 head
 SCRIPT LANGUAGE=JavaScript
 data = hello world;
 /script
 /head
 body
 ?
 echo $databr;
 ?
 /body
 /html

 The above might at least give me a clue.  Just a note.  I really know
 nothing to speak of about JavaScript.

 Thanks in Advance
 Steve



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




RE: [PHP] javascript and PHP

2002-04-29 Thread Leotta, Natalie (NCI/IMS)

This is what I do in one of my programs.  I set hidden values in my HTML and
then JS can access them, change them, and then when the form is submitted
(JS can do that too if you want it to be automatic) the PHP reads in the
hidden values.

-Natalie

-Original Message-
From: 1LT John W. Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Monday, April 29, 2002 11:40 AM
To: [EMAIL PROTECTED]; Steve Buehler
Subject: Re: [PHP] javascript and PHP


All you can do is use PHP to print out Javascript code.

?
$data = hello world;
?
script language=javascript
var something;
something = '?=$data?';
/script

etc...It's no different than using PHP to print out HTML code.

Now, if you want to get that Javascript variable something sent back to
PHP, you have to assign it to a form element or tack it onto a URL.

---John Holmes...

- Original Message -
From: Steve Buehler [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, April 29, 2002 11:29 AM
Subject: [PHP] javascript and PHP


 Does anybody know of a good/short tutorial about passing variables 
 from JavaScript to/from PHP?  For example, how to do the following:

 html
 head
 SCRIPT LANGUAGE=JavaScript
 data = hello world;
 /script
 /head
 body
 ?
 echo $databr;
 ?
 /body
 /html

 The above might at least give me a clue.  Just a note.  I really know 
 nothing to speak of about JavaScript.

 Thanks in Advance
 Steve



-- 
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??

2002-04-03 Thread Maxim Maletsky

Use header to start file download:

http://www.php.net/manual/en/function.header.php

Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com




 -Original Message-
 From: Joe Keilholz [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 04, 2002 1:12 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Javascript and PHP??
 
 Hello All!
 
 I think this is a pretty simple question. I have a file that I am
writing
 information to and when the process is complete, I am needing to send
the
 file to the user. In Javascript all I would need to do is
window.open() and
 the file would be sent to the user (it's a .csv file). How would I
 accomplish this in PHP? Can I incorporate Javascript into my PHP code?
If
 so, how?
 
 Any help would be appreciated!
 Thanks!
 Joe Keilholz
 
 
 
 --
 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??

2002-04-03 Thread Mikhail Avrekh

You can say something like:

?$csv_filename= whatever.csv;?
script language=javascript
window.open(?=$csv_filename?,
target,
resizable,status,width=500,height=200);
/script



On Wed, 3 Apr 2002, Joe Keilholz wrote:

 Hello All!

 I think this is a pretty simple question. I have a file that I am writing
 information to and when the process is complete, I am needing to send the
 file to the user. In Javascript all I would need to do is window.open() and
 the file would be sent to the user (it's a .csv file). How would I
 accomplish this in PHP? Can I incorporate Javascript into my PHP code? If
 so, how?

 Any help would be appreciated!
 Thanks!
 Joe Keilholz



 --
 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??

2002-04-03 Thread Jamie Watt

?php header(Location: $csv_filename); ?


Mikhail Avrekh [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 You can say something like:

 ?$csv_filename= whatever.csv;?
 script language=javascript
 window.open(?=$csv_filename?,
 target,
 resizable,status,width=500,height=200);
 /script



 On Wed, 3 Apr 2002, Joe Keilholz wrote:

  Hello All!
 
  I think this is a pretty simple question. I have a file that I am
writing
  information to and when the process is complete, I am needing to send
the
  file to the user. In Javascript all I would need to do is window.open()
and
  the file would be sent to the user (it's a .csv file). How would I
  accomplish this in PHP? Can I incorporate Javascript into my PHP code?
If
  so, how?
 
  Any help would be appreciated!
  Thanks!
  Joe Keilholz
 
 
 
  --
  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 to php ????

2001-11-14 Thread Grimes, Dean

One way I do this is with the following:

?php
if ($submit) {
// Create a php array.
$t_array = explode(,,$x_array);
print_r($t_array);
exit;
}
?

html
head
script language=javascript
var x = new Array();
x[0] = zero;
x[1] = one;
x[2] = two;
/script
/head

body
form name=f method=post
input type=submit name=submit
input type=hidden name=x_array
/form

!--
Use an onSubmit clause in the form tag to execute a function that
sets any hidden form values you need. This little test just falls
through but it doesn't have to.
--

script language=javascript
// set the hidden input to a comma delimited string
document.f.x_array.value = x.toString();

// alert(document.f.x_array.value);
/script
/body
/html


Hope this helps.

Dean


-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 4:54 PM
To: PHP General
Subject: [PHP] javascript to php 


Hi  =)

is it possible to pass a javascript array to php ???


thanks.


-- 
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 to php ????

2001-11-14 Thread Mike Eheler

No.

You have to realise that JavaScript is client side, and PHP is server 
side, so -- apart from inserting those javascript values into a form and 
submitting it using code -- PHP and JavaScript cannot interact.

Mike

fitiux wrote:

Hi  =)

is it possible to pass a javascript array to php ???


thanks.





-- 
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 to php ???????

2001-11-14 Thread Mark

On Wed, 14 Nov 2001 10:30:03 +1100, Martin Towell wrote:
That's why I put quotes around the words - obviously a function
would be
need to be written to do the serialising and a corresponding php
function
to retrieve the values and place them into an array again.

oops, I guess I misread that. You're right, that's crazy enough to
work. a serialize function in javascript that serializes things the
same way as php would be very useful, probably an unserialize
function would be too.


-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:28 AM
To: [EMAIL PROTECTED]; PHP General
Subject: RE: [PHP] javascript to php ???


On Wed, 14 Nov 2001 10:16:42 +1100, Martin Towell wrote:
serialise the array and make the value of a hidden field this
value.
Then in PHP unserialise it.

that would work great if it were a php array, but I believe we're
talking about javascript arrays here. :)

-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:18 AM
To: PHP General
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript to php ???


Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's
job
and left the building. If you mean can javascript pass variables
to
a
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a
form,
the action of this form is call again to the php page.
I mean...
  test.php - (make an html page)--- question.html ---
(submit
form) test.php

I populated an array but now I need to pass this array to the same
starting
php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you
can
understand me.. )








--
Mark, [EMAIL PROTECTED] on 11/14/2001



--
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 to php ????

2001-11-13 Thread Mark

On Tue, 13 Nov 2001 19:53:48 -0300, fitiux wrote:
Hi  =)

is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's job
and left the building. If you mean can javascript pass variables to a
new request for php to handle, then sure.


--
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 to php ???????

2001-11-13 Thread fitiux

Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's job 
and left the building. If you mean can javascript pass variables to a 
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a form,
the action of this form is call again to the php page.
I mean... 
test.php - (make an html page)--- question.html ---(submit form) 
test.php

I populated an array but now I need to pass this array to the same starting php page 
again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you can understand me.. 
)






RE: [PHP] javascript to php ???????

2001-11-13 Thread Martin Towell

serialise the array and make the value of a hidden field this value.
Then in PHP unserialise it.

-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:18 AM
To: PHP General
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript to php ???


Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's job 
and left the building. If you mean can javascript pass variables to a 
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a form,
the action of this form is call again to the php page.
I mean... 
test.php - (make an html page)--- question.html ---(submit
form) test.php

I populated an array but now I need to pass this array to the same starting
php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you can
understand me.. )






Re: [PHP] javascript to php ???????

2001-11-13 Thread Mark

On Tue, 13 Nov 2001 20:17:32 -0300, fitiux wrote:
   Hi  =)
is it possible to  pass a javascript array to php ???

by the time javascript comes into  play, php has already done it's
job
and left the building. If you mean  can javascript pass variables
to a
new request for php to handle, then  sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with  javascript to validate a
form,
the action of this form is call again to the php  page.
I mean...
test.php  - (make an html page)--- question.html ---
(submit form)  test.php

I populated an array but now I need to pass  this array to the same
starting php page again.

can I do this?

sure. for GET you would just make a request out of the variables,
i.e.:
var url=/mypage.php?value[0]=+value[0]+value[1]=+value[1];
document.location.href=url;

you can do this in a loop if you want. for POST you would use hidden
fields, i.e.:

document.write('input type=hidden name=value[0]
value='+value[0]+'');
document.write('input type=hidden name=value[1]
value='+value[1]+'');

you could do this in a loop too.



--
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 to php ???????

2001-11-13 Thread Mark

On Wed, 14 Nov 2001 10:16:42 +1100, Martin Towell wrote:
serialise the array and make the value of a hidden field this
value.
Then in PHP unserialise it.

that would work great if it were a php array, but I believe we're
talking about javascript arrays here. :)

-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:18 AM
To: PHP General
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript to php ???


Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's
job
and left the building. If you mean can javascript pass variables to
a
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a
form,
the action of this form is call again to the php page.
I mean...
test.php - (make an html page)--- question.html ---
(submit
form) test.php

I populated an array but now I need to pass this array to the same
starting
php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you
can
understand me.. )






--
Mark, [EMAIL PROTECTED] on 11/13/2001



--
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 to php ???????

2001-11-13 Thread Richard S. Crawford

Why, sure!

In your FORM tag, use ACTION=test.php.

You can send your JavaScript variable as part of the form, in a hidden form 
field such as INPUT TYPE=hidden VALUE=myValue.  The value of the variable 
will be available the next time test.php shows up as $myValue.  You can 
then manipulate it to your heart's delight.


At 03:17 PM 11/13/2001, fitiux wrote:
 Hi  =)
 is it possible to pass a javascript array to php ???

 by the time javascript comes into play, php has already done it's job
 and left the building. If you mean can javascript pass variables to a
 new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a form,
the action of this form is call again to the php page.
I mean...
 test.php - (make an html page)--- question.html ---(submit 
 form) test.php

I populated an array but now I need to pass this array to the same 
starting php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you can 
understand me.. )


Sliante,
Richard S. Crawford

http://www.mossroot.com
mailto:[EMAIL PROTECTED]
AIM: Buffalo2K   ICQ: 11646404  Y!: rscrawford
It is only with the heart that we see rightly; what is essential is 
invisible to the eye.  --Antoine de Saint Exupéry

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]




RE: [PHP] javascript to php ???????

2001-11-13 Thread Martin Towell

That's why I put quotes around the words - obviously a function would be
need to be written to do the serialising and a corresponding php function
to retrieve the values and place them into an array again.

-Original Message-
From: Mark [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:28 AM
To: [EMAIL PROTECTED]; PHP General
Subject: RE: [PHP] javascript to php ???


On Wed, 14 Nov 2001 10:16:42 +1100, Martin Towell wrote:
serialise the array and make the value of a hidden field this
value.
Then in PHP unserialise it.

that would work great if it were a php array, but I believe we're 
talking about javascript arrays here. :)

-Original Message-
From: fitiux [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 14, 2001 10:18 AM
To: PHP General
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript to php ???


Hi  =)
is it possible to pass a javascript array to php ???

by the time javascript comes into play, php has already done it's
job
and left the building. If you mean can javascript pass variables to
a
new request for php to handle, then sure.


Thanks for your reply.  =)

I have a little problem..
well.. with php I build an html page with javascript to validate a
form,
the action of this form is call again to the php page.
I mean...
test.php - (make an html page)--- question.html ---
(submit
form) test.php

I populated an array but now I need to pass this array to the same
starting
php page again.

can I do this?


--Patricio


(I apology because my english is not good enough.. I hope that you
can
understand me.. )






-- 
Mark, [EMAIL PROTECTED] on 11/13/2001




Re: [PHP] javascript to php ???? THANKS =)

2001-11-13 Thread fitiux

Thanks to all for help me..
=)


I hope to help someone soon.  


--Patricio.




Re: [PHP] javascript to php

2001-03-29 Thread Jack Dempsey

what exactly are you trying to do? pass variables to a php script? then
use a form with POST or GET...not that simple? describe better what
you're doing then...

-jack

cam k wrote:
 
 does anyone know how to pass values in javascript variables to php
 variables?? Or a workaround if no direct solution...
 
 --
 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-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]




Re: [PHP] javascript VS php

2001-03-01 Thread Reuben D Budiardja

Javascript (js) is client side and PHP is server side. So what you can do 
to call the php function is by re-submitting the page, with somekind of a 
flag from the js to call the php function.
You write the php parts like:

if($flag)
   callTheFunctions(args);

Reuben D. B

At 04:28 PM 3/1/01 +, Miguel Loureiro wrote:
Hello all
I would like to know if its possible from a javascript function call a php 
function (uiuiuiuiui...) ?
This because I have a bidimensional array, and when user select a option 
of a checbox, on javascript function I read the selectedIndex and want to 
see the values of that name ( see arr[selectedIndex] with for cicle).
If not possible(and I think it isnt), there is any solution?
TY all
Best Regards
Miguel Loureiro [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 in PHP statement

2001-02-15 Thread Michael Hall


 I am new to php and I am wondering if it is possible to use a javascript
 variable in a php statement for example:
 
 // create sql statement
 
   $sql = "select * from main where businesstype = "consultancy" and
 top.upper.villagename = != "0";";

As far as I know, no. Unless "top.upper.villagename" is a field in your
database and the rest is that field's contents (couldn't be ... too many
unescaped double quotes and semicolons). Nope, SQL statements don't work
like that and can only refer directly to data in a database, not php or
any other variables.

You might consider using if statements something like this:

if ($top.upper.villagename != '0') {
$sql = "SELECT * FROM main WHERE business = 'consultancy'";
}


Hope this helps

Mick


-- 
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 in PHP statement

2001-02-15 Thread DanO


note that javascript and PHP CANNOT interact natively on the same page...one
is client side and one is server side.

you can pass variables between the two in an HTTP request, however.

page1.php:

script type=javascript
function makeSqlQuery(businesstype,village) {
var sqlQuery;
sqlQuery = "SELECT * FROM MAIN WHERE BUSINESSTYPE="
+ businesstype +
" AND VILLAGE="
+ village
location = "php2.php?sqlQuery=" + sqlQuery;
}
/script
form name=thisform
select name=businesstype
/select
select name=village
/select
input type=button
onclick="makeSqlQuery(thisform.businesstype,thisform.village)"
/form

--

this is a silly way to do it, however, and you should just pass the
variables themselves and construct and run the query in a new request using
php.

you use the same page with control structures on it.

DanO


-Original Message-
From: Michael Hall [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 12:06 PM
To: Matt Davis
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] javascript in PHP statement



 I am new to php and I am wondering if it is possible to use a javascript
 variable in a php statement for example:

 // create sql statement

   $sql = "select * from main where businesstype = "consultancy" and
 top.upper.villagename = != "0";";

As far as I know, no. Unless "top.upper.villagename" is a field in your
database and the rest is that field's contents (couldn't be ... too many
unescaped double quotes and semicolons). Nope, SQL statements don't work
like that and can only refer directly to data in a database, not php or
any other variables.

You might consider using if statements something like this:

if ($top.upper.villagename != '0') {
$sql = "SELECT * FROM main WHERE business = 'consultancy'";
}


Hope this helps

Mick


--
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]




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)
form name=oFrm
 input name=zip onBlur='fetch();'input name=city
/form

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):
script
 opener.document.oFrm.city.value = "$the_right_city";
 self.close();
/script

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!
-Jrg 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]