Re: passing variables from javascript to php
| From: | m.lawrie | Date: | Sun, 14 Oct 2001 10:21:51 +0000 |
| Subject: | Re: passing variables from javascript to php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71022@lists.php.net to get a copy of this message | ||
I don't know if this got ignored as off topic. Anyway, to answer the
question, how to pass javascript variables to php, I found this code
fragment:
<script language="JavaScript">
<!--
abc=window.prompt("Please enter a word.");
<? if (!$abc) echo "document.location =
\"$PHP_SELF?abc=\" + abc;"; ?>
// -->
</script>
"m.lawrie" wrote:
>
> <SCRIPT LANGUAGE='javascript'><!--
>
> var array = parent.main.location.pathname;
> endarray = array.split('/');
> popped = endarray.pop();
> splitted = popped.split('.');
> linkname = splitted.shift();
> document.write(linkname);
>
> //--></SCRIPT>
>
> <?php
> include("dblink.inc");
>
> $query = "select * from glck_zahl where game='linkname'"; etc...
> ?>
>
> These two fragments are from the same file, respectively. Doubtless
> inelegant. Is there a way to make my javascript variable available to
> php? Alternatively, can I somehow do cross frame scripting with php?
> should I try to nest some kind of javascript frames communication within
> php perhaps?
> many thanks for suggestions,
> magnus lawrie
>
> --
> 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