You are here: Re: nOOb question... « PHP Language « IT news, forums, messages
Re: nOOb question...

Posted by Kimmo Laine on 11/08/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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация