Page 1 of 1

PHP and JavaScript

Posted: Mon Jun 24, 2002 9:50 am
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>

Posted: Mon Jun 24, 2002 10:16 am
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).

Posted: Mon Jun 24, 2002 11:38 am
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?

Posted: Tue Jun 25, 2002 1:44 am
by twigletmac
You could use sessions.

Mac