You are here: Re: Can I overrule an internal bookmark eg script.php#middle in case of error? « PHP Programming Language « IT news, forums, messages
Re: Can I overrule an internal bookmark eg script.php#middle in case of error?

Posted by Schraalhans Keukenmeester on 04/03/07 10:50

zzapper wrote:
> On Apr 2, 3:33 pm, Toby A Inkster <usenet200...@tobyinkster.co.uk>
> wrote:
>> zzapperwrote:
>>> I use an internal bookmark
>>> <form method="post" action="${form_action}#mark1">
>>> to return to the correct place in the page.
>>> In case of an error I would wish to return to the top of the screen
>>> can I overrule the bookmark "mark1" in my PHP code?
>> No, but your results page could put id="mark1" at the top of the page
>> instead of further down.
>>
>> --
> Toby
> Can I "Read" the value of this bookmark from the PHP environment
> variables?
>
> --
> zzapper
> Best of VimTips
> http://www.vim.org/tips/tip.php?tip_id=305
>
>
You can get to it via $_POST['action'].
Look for the position of the '#' using strpos(), then substr() the
desired part from the total string.
e.g.

<?PHP
$bookmark=false;
if (isset($_POST['action']){
if ($poundpos=strpos($_POST['action'],'#')!=false){
$bookmark=substr($_POST['action'],$poundpos);
}
}
if ($bookmark){
//your code here
}

?>

There are other ways to get the bookmark part from the string, using
explode() for example. This is just one idea.
HTH

Sh.

 

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

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