Using JavaScript variables as part of PHP

General discussions related to php

Moderators: macek, egami, gesf

jesso3
New php-forum User
New php-forum User
Posts: 8
Joined: Mon Feb 17, 2003 4:53 pm

Using JavaScript variables as part of PHP

Postby jesso3 » Mon Feb 17, 2003 5:01 pm

Hello. I am new to PHP and learning the language. I have JavaScript variables on a .htm page. I have another page that is a .php. What I like to do is use a variable like say for instance: var time; and manipulate it in my PHP file. Can anyone show me how it is done? Thanks.

Romantik
New php-forum User
New php-forum User
Posts: 67
Joined: Mon Feb 24, 2003 2:55 am
Location: ../Ukraine/Kherson
Contact:

Postby Romantik » Mon Feb 24, 2003 5:02 am

ONLY Submit form!!!

<?
if(isset($_POST["MyInp"])OR(isset($_POST["MyInp1"]))
{
echo "MyVar=".$_POST["MyInp"];
echo "<BR>";
echo "MyVar1=".$_POST["MyInp1"];
}
else
{
?>
<FORM name="name" method="POST" action="<? echo $_SERVER['PHP_SELF'];?>">
<SCRIPT>
var MyParam= 123;
document.name.MyInp.value= MyParam;
</SCRIPT>
<INPUT type="hidden" name="MyInp">
<INPUT type="text" name="MyInp1" value="10">
<INPUT type="submit">
</FORM>
<?}?>


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest