PHP and JavaScript

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
FlashMan
Forum Newbie
Posts: 15
Joined: Mon Jun 24, 2002 9:50 am
Location: Russia
Contact:

PHP and JavaScript

Post by FlashMan »

I was make simple form for testing compatibility between php and javascript.
I tested it on this:
onclick - run javascript, form not submitted(it is running javascript), but i want to access to variables of this form in body of javascript in PHP. If this is real, then form will make more and more faster :D

<script language="JavaScript">
<!--
function dojs()
{
<?
// can I gain access to form variables without submitting???
?>
}
//-->

<form>
<input type="text" name="name">
<input type="button" onclick=dojs()">
</form>
will
Forum Contributor
Posts: 120
Joined: Fri Jun 21, 2002 9:38 am
Location: Memphis, TN

Post by will »

FlashMan wrote:can I gain access to form variables without submitting???
no. because PHP is a server-sided language, once it sends the page to the user, it's job is through. no more can be done with PHP until the data is sent back to the server (ie, submitting the form).
FlashMan
Forum Newbie
Posts: 15
Joined: Mon Jun 24, 2002 9:50 am
Location: Russia
Contact:

Post by FlashMan »

:cry:
I creating a program like this:
<form>
<form>
<form>
<form>
<form>
...
all in one file! 'cause forms is a lot.

Some fields from ealiering forms are need in next forms. I do so:
I creating hidden fields with copy of needed fields.
But may be exist more better choice?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

You could use sessions.

Mac
Post Reply