Re: Passing variables from javascript to php

From: Date: Thu, 14 Dec 2000 22:01:02 +0000
Subject: Re: Passing variables from javascript to php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-30369@lists.php.net to get a copy of this message
You could try something like this: <script language="JavaScript"> <!-- abc=window.prompt("Please enter a word."); <? if (!$abc) echo "document.location = \"$PHP_SELF?abc=\" + abc;"; ?> // --> </script> The problem is php is run on the server, so it used before the javascript. "Police Trainee" <policetrainee@yahoo.com> wrote in message news:20001214152035.16556.qmail@web1105.mail.yahoo.com... > I decided to try and learn some javascript. > Being the pure simpleton that I am, I tested the > oh-so-simple: > > <script language="JavaScript"> > <!-- > abc=window.prompt("Please enter a word."); > // --> > </script> > > I know it stores the variable because > document.write(abc) prints it > > but the variable apparently doesn't pass to php... > > <? echo("$abc");?> //placed after the </script> tag > > > soooooo, what should I be aware of in order to make it > work? > > thank you > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Shopping - Thousands of Stores. Millions of Products. > http://shopping.yahoo.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#30369) next »