473,320 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How to use javascript in php?

Hi,

How to use javascript in php?
I want to return some values to php.
Thanks

--
Shang Wenbin from Realss
Jul 23 '05 #1
20 1429
Shang Wenbin wrote on 25 apr 2005 in comp.lang.javascript:
Hi,
Hi too
How to use javascript in php?
You cannot. PHP does not support JS.
However, ...
I want to return some values to php.


if you are asking how to send a clientside javascript value
to serverside [PHP, ... ]:

<form id=f method=post>
<input type=hidden name=JSvalue id=h>
</form>

.....

document.getElementById('h').value="Hello"
document.getElementById('f').submit()

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2
You need to embed the he javascript into your php.

e.g.

echo "<html><body><head>";
echo "<script LANGUAGE=\"JavaScript1.4\" type=\"text/javascript\"">;
echo "function sayHello(){";
echo "alert(\"hello\");";
echo "</script></head></body></html>";

Jul 23 '05 #3
Ash
Or you could perhaps gather your results in clientside Javascript, and pass
the values back to the PHP by refreshing the page and passing the results as
part of the Querystring?

Cheers, Ash

<cl*****@eircom.net> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
You need to embed the he javascript into your php.

e.g.

echo "<html><body><head>";
echo "<script LANGUAGE=\"JavaScript1.4\" type=\"text/javascript\"">;
echo "function sayHello(){";
echo "alert(\"hello\");";
echo "</script></head></body></html>";

Jul 23 '05 #4
wrote on 25 apr 2005 in comp.lang.javascript:
You need to embed the he javascript into your php.
1 please quote the text you are answering on, this is usenet.

2 why embed?
echo "<html><body><head>";
echo "<script LANGUAGE=\"JavaScript1.4\" type=\"text/javascript\"">;
echo "function sayHello(){";
echo "alert(\"hello\");";
echo "</script></head></body></html>";


--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #5
Ash
> 1 please quote the text you are answering on, this is usenet.

Why are there always picky arseholes such as yourself within Newsgroups?? it
is quite clear what Evertjan is suggesting, he has interpreted 'Shang
Wenbin''s original post as "...how to utilise 'clientside' javascript..." as
opposed to 'serverside', in which case his example is quite clear.

If you haven't got anything positive to post that will aid an enquiry,
simply do not post.

Shang Wenbin, does the above answer your query?

Cheers, Ash
Jul 23 '05 #6
"Ash" <sp******@a-hall.com> wrote:
If you haven't got anything positive to post that will aid an
enquiry, simply do not post.
Right so.
Shang Wenbin, does the above answer your query?


You didn't give any answer in your post.

Bye,
Martin
Jul 23 '05 #7
@sh
> If you haven't got anything positive to post that will aid an enquiry,
simply do not post.
....see above post.
"Martin Bialasinski" <ag********@uni-koeln.de> wrote in message
news:87************@haitech.martin.home... "Ash" <sp******@a-hall.com> wrote:
If you haven't got anything positive to post that will aid an
enquiry, simply do not post.


Right so.
Shang Wenbin, does the above answer your query?


You didn't give any answer in your post.

Bye,
Martin

Jul 23 '05 #8
"@sh" <sp******@a-hall.com> wrote:
If you haven't got anything positive to post that will aid an enquiry,
simply do not post.


...see above post.
"Martin Bialasinski" <ag********@uni-koeln.de> wrote in message
news:87************@haitech.martin.home...
"Ash" <sp******@a-hall.com> wrote:
If you haven't got anything positive to post that will aid an
enquiry, simply do not post.


Right so.
Shang Wenbin, does the above answer your query?


You didn't give any answer in your post.

Bye,
Martin


The post above is <3d*************@individual.net>

!* [ 14: Dietmar Meier ] Re: html drop down menus & adding an item to the a list.

Could you elaborate?

Bye,
Martin
Jul 23 '05 #9
@sh
Refering back to my original post...
Why are there always picky arseholes such as yourself within Newsgroups??


Point proven...
Jul 23 '05 #10
Ash wrote:
1 please quote the text you are answering on, this is usenet.

Why are there always picky arseholes such as yourself within Newsgroups??


Because there are always stupid idiots like you within Newsgroups.
it is quite clear what Evertjan is suggesting,
Evertjan is the one that requested some non-quoting idiot quote what
they are replying to. Perhaps you should re-read what it is that you are
babbling about.
he has interpreted 'Shang Wenbin''s original post as "...how to
utilise 'clientside' javascript..." as opposed to 'serverside', in
which case his example is quite clear.
Actually, its not, but you wouldn't understand that.
If you haven't got anything positive to post that will aid an enquiry,
simply do not post.
This is Usenet. Get used to it, move on. And, read a groups FAQ before
posting here. Ours (comp.lang.javascript) is posted here many many times
a day in URL form, and 3 times a week in text form. In fact, it was
posted yesterday. Search the archives of c.l.j for "FAQ Poster".

http://www.jibbering.com/faq/
Shang Wenbin, does the above answer your query?


Are you as stupid as you act/seem to be? Your "above" has nothing to do
with the "query".

--
Randy
Jul 23 '05 #11
@sh
Yet again, refering back to my original post...
Why are there always picky arseholes such as yourself within Newsgroups??
Point proven...

No wonder the poor chap (Shang) has left the thread!

Cheers, Ash
"Randy Webb" <Hi************@aol.com> wrote in message
news:eL********************@comcast.com... Ash wrote:
1 please quote the text you are answering on, this is usenet.

Why are there always picky arseholes such as yourself within Newsgroups??


Because there are always stupid idiots like you within Newsgroups.
it is quite clear what Evertjan is suggesting,


Evertjan is the one that requested some non-quoting idiot quote what they
are replying to. Perhaps you should re-read what it is that you are
babbling about.
he has interpreted 'Shang Wenbin''s original post as "...how to utilise
'clientside' javascript..." as opposed to 'serverside', in which case his
example is quite clear.


Actually, its not, but you wouldn't understand that.
If you haven't got anything positive to post that will aid an enquiry,
simply do not post.


This is Usenet. Get used to it, move on. And, read a groups FAQ before
posting here. Ours (comp.lang.javascript) is posted here many many times a
day in URL form, and 3 times a week in text form. In fact, it was posted
yesterday. Search the archives of c.l.j for "FAQ Poster".

http://www.jibbering.com/faq/
Shang Wenbin, does the above answer your query?


Are you as stupid as you act/seem to be? Your "above" has nothing to do
with the "query".

--
Randy

Jul 23 '05 #12
JRS: In article <d4**********@titan.btinternet.com>, dated Tue, 26 Apr
2005 09:17:45, seen in news:comp.lang.javascript, Ash <spam_ash@a-
hall.com> posted :
1 please quote the text you are answering on, this is usenet.


Why are there always picky arseholes such as yourself within Newsgroups?? it
is quite clear what Evertjan is suggesting, he has interpreted 'Shang
Wenbin''s original post as "...how to utilise 'clientside' javascript..." as
opposed to 'serverside', in which case his example is quite clear.

If you haven't got anything positive to post that will aid an enquiry,
simply do not post.

If you want help from the experts here, it behoves you to act in a
manner which pleases the experts here. If you choose not to do that,
they are rather likely to choose not to help you. Complaining in that
manner is a good way to get yourself noticed as the sort of person who
is best left for the incompetent to answer.

--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME ©
Web <URL:http://www.uwasa.fi/~ts/http/tsfaq.html> -> Timo Salmi: Usenet Q&A.
Web <URL:http://www.merlyn.demon.co.uk/news-use.htm> : about usage of News.
No Encoding. Quotes before replies. Snip well. Write clearly. Don't Mail News.
Jul 23 '05 #13
Shang Wenbin wrote:
How to use javascript in php?
Depends. Client-side JS or server-side JS? Client-side or server-side PHP?
I want to return some values to php.


Could you please be more specific?
PointedEars
Jul 23 '05 #14
cl*****@eircom.net wrote:
You need to embed the he javascript into your php.
No, he does not. It is one way, but it is not the only one.
e.g.
Very much "e.g.", indeed.
echo "<html><body><head>";
echo "<script LANGUAGE=\"JavaScript1.4\" type=\"text/javascript\"">;
echo "function sayHello(){";
echo "alert(\"hello\");";
echo "</script></head></body></html>";


Do you have even a single clue about the languages you are using?

1. The above is as inefficient in PHP as it can be. PHP is the
PHP Hypertext *Preprocessor*. What is not within `<?php ... ?>'
(or `<? ... ?>' with short_open_tag=on) is not parsed by PHP
but simply thrown to stdout, i.e. raw data to be transferred to
the client by the Web server if used in a CGI environment.

2. The above will not generate Valid HTML, since
- the DOCTYPE declaration is missing
- the `body' element must not contain the `head' element
- the `title' element is missing.

see <http://validator.w3.org/>.
This will force the User Agent to use Quirks Mode, if available,
and so produce unreliable results.

3. The `language' attribute is deprecated in HTML 4 and XHTML 1, and
the attribute value you are using is, at the most, not fitted for
the task.

Correction
-----------

Optionally before:

<?php
...
?>

Mandatory regarding the task:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/strict.dtd">
<html>
<head>
<title>JavaScript in a PHP script</title>

<script type="text/javascript">
function sayHello()
{
alert("hello");
}
</script>
</head>

<body>
...
</body>
</html>

Optionally after:

<?php
...
?>
PointedEars
Jul 23 '05 #15
Thomas 'PointedEars' Lahn wrote:
Shang Wenbin wrote:

How to use javascript in php?

Depends. Client-side JS or server-side JS? Client-side or server-side PHP?


I have asked in the past, and you ignored it. Can you give an example of
Client-Side PHP?
Even the PHP site says it is a server side language.......

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #16
Randy Webb wrote:
Can you give an example of Client-Side PHP?


Great fun: http://www.sitepoint.com/blog-post-view.php?id=181248

ciao, dhgm (who likes to use Perl for MSIE scripting sometimes)
Jul 23 '05 #17
@sh
Its 'do right' pricks like you that scare those genuinely in need of help
away.

....and yes I'm top posting ;o) cause I know it'll irritate you.

Ash
"Thomas 'PointedEars' Lahn" <Po*********@web.de> wrote in message
news:13****************@PointedEars.de...
cl*****@eircom.net wrote:
You need to embed the he javascript into your php.


No, he does not. It is one way, but it is not the only one.
e.g.


Very much "e.g.", indeed.
echo "<html><body><head>";
echo "<script LANGUAGE=\"JavaScript1.4\" type=\"text/javascript\"">;
echo "function sayHello(){";
echo "alert(\"hello\");";
echo "</script></head></body></html>";


Do you have even a single clue about the languages you are using?

1. The above is as inefficient in PHP as it can be. PHP is the
PHP Hypertext *Preprocessor*. What is not within `<?php ... ?>'
(or `<? ... ?>' with short_open_tag=on) is not parsed by PHP
but simply thrown to stdout, i.e. raw data to be transferred to
the client by the Web server if used in a CGI environment.

2. The above will not generate Valid HTML, since
- the DOCTYPE declaration is missing
- the `body' element must not contain the `head' element
- the `title' element is missing.

see <http://validator.w3.org/>.
This will force the User Agent to use Quirks Mode, if available,
and so produce unreliable results.

3. The `language' attribute is deprecated in HTML 4 and XHTML 1, and
the attribute value you are using is, at the most, not fitted for
the task.

Correction
-----------

Optionally before:

<?php
...
?>

Mandatory regarding the task:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/strict.dtd">
<html>
<head>
<title>JavaScript in a PHP script</title>

<script type="text/javascript">
function sayHello()
{
alert("hello");
}
</script>
</head>

<body>
...
</body>
</html>

Optionally after:

<?php
...
?>
PointedEars

Jul 23 '05 #18
@sh
Sorry to Thomas PointedEars Lahn as I note I've responded to the wrong area
of the thread, my response was actually aimed at Randy Webb.
Jul 23 '05 #19
@sh wrote:
Sorry to Thomas PointedEars Lahn as I note I've responded to the wrong area
of the thread, my response was actually aimed at Randy Webb.


So, let's get this straight.

1) You are too stupid to reply to the proper post.
2) It only took you almost a month to come up with that reply.
3) When correcting yourself you were too stupid to quote what you were
babbling about.
4) If you weren't so stupid, you would be funny.

Got it. Your move stupid.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Jul 23 '05 #20
@sh
> 1) You are too stupid to reply to the proper post.

I didn't feel your branch deserved to be extended
2) It only took you almost a month to come up with that reply.
Ohhhh dreadfully sorry, been on holiday in Sharm (Egypt) for the past 4
weeks, your pathetic 'babbling' I'm sure could wait.
3) When correcting yourself you were too stupid to quote what you ere
babbling about.
Your jibberings need not be quoted.
4) If you weren't so stupid, you would be funny.
Ahhhh, like your name? Sounds more like a cheap porn site!
Got it. Your move stupid.


....Thanks, hmmmm, no comment, you've just proven my point.

Cheers, @sh
Jul 23 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.