Posted by Kimmo Laine on 11/27/72 11:25
"Mich" <PleaseAskInThread@nl.nl> wrote in message
news:43159479$0$11061$e4fe514c@news.xs4all.nl...
> ----- Original Message -----
> From: "ZeldorBlat" <zeldorblat@gmail.com>
> Newsgroups: alt.comp.lang.php
> Sent: 31 August, 2005 03:02
> Subject: Re: nOOb question...
>
>
>> What exactly is the error you're getting?
>>
>> My guess is that you're getting something about a parse error --
>> because you're trying to mix JavaScript with PHP.
>>
>> Remeber that that JavaScript runs client side -- which means the code
>> needs to be output to the browser along with the HTML. I think what
>> you really want is something like this:
>>
>> <?php
>> if(isset($_GET['postcode'])) {
>> $invoer = $_GET['postcode'];
>> ?>
>> frames["winkels"].location.href = "storelocator2.php?postcode=" +
>> <?
>> php echo $invoer; ?>;
>> <?php } ?>
>>
>> The idea is that you can escape between HTML and PHP code and it will
>> usually behave as expected. Anything between the <?php and ?> will be
>> parsed as PHP; the rest will be sent straight to the browser.
>>
>
> Thankx Zeldor,
>
> Had to adjust a little, but got it working in the end.
>
> <?php
> if (isset($_GET['postcode']))
> {
> $invoer = $_GET['postcode'];
> ?>
> <script type="text/javascript">
> var whatever = "<?= $invoer ?>";
> frames['winkels'].location.href = 'storelocator2.php?postcode=' +
> whatever
> </script>
> <?php
> }
> ?>
This should also work:
<?php if (isset($_GET['postcode'])){ ?>
<script type="text/javascript">
frames['winkels'].location.href = 'storelocator2.php?postcode=<?=
$_GET['postcode'] ?>';
</script>
<?php } ?>
--
Welcome to Usenet! Please leave tolerance, understanding
and intelligence at the door. They aren't welcome here.
eternal piste erection miuku gmail piste com
[Back to original message]
|