Reply to Re: nOOb question...

Your name:

Reply:


Posted by Mich on 10/25/33 11:25

----- 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
}
?>

For some reason this: frames["winkels"].location.href =
"storelocator2.php?postcode=" +<?php echo $invoer; ?>;
didn't get any characters through, though it did numbers.

Also:
frames['winkels'].location.href = 'storelocator2.php?postcode=' + "<?=
$invoer ?>"
Works well.

Thankx for the help, very much appreciated.

[Back to original 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

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