I have a PHP foreground loop that is getting an array of data. A special array is an href in my resonance statement, I'm adding special href to my next page like this:
echo & lt; A href = "nextpage.php? Url = '.ats.' '& Gt; Statistics & lt; / a & gt;' This redirects to my next page and I can get url by $ _GET. I get the problem after # in the appended url For example, the URL on the next page looks like this:
stats.php? Url = basket-planet.com / ru / results / ukraine /? Date = 2013- 03-17 # Game-2919 I want to be able to get #Games-2919 in JavaScript or jQuery on the first page, joining it with URL Go to the stairs.php page is this possible? I know that I can not get value after # in PHP because it is not sent to server side. Is there an alternative solution for this?
Here's what I'm thinking of:
echo '& lt; a href = "#" onclick = "stats ('. '); "& Gt; Statistics & lt; / a & gt; '; & lt; script type =" text / javascript "& gt; function statistics (url) {var hash = window.location.hash.replace (" # ", ""); Alert (hash);} but it is not working, I have not received any warning, so I can not try AJAX and do not redirect to the next page Thank you in advance.
Update: This is my complete index.fp page.
& lt ;? php include_once ('simple_html_dom.php'); $ Html = File_get_html ('http://basket-planet.com/ru/'); $ ($ Games-> ($ stats = $ games-> Children (5) - foreach ($ html- & gt; Search ('div' [class = games] div [class = games-1] div [class = Game] ')' gt; & gt; href; echo & lt; table? & Lt; tr & gt; & lt; td & gt; & lt; a href = "stats.php? Url = http: //www.basket- Planet.com '.stats.' & Gt; Figures & lt; / a & gt; & lt; / TD & gt; & lt; / tr & gt; & lt; / table & gt; ';}? & Gt; My stats.php page:
& lt ;? php include_once ('simple_html_dom.php'); $ Url = $ _GET ['url']; // $ hash = $ _GET ['hash']; $ Html = file_get_html (''. $ Url. ''); $ Stats = $ html-> Search ('div [class = fullStats]', 3); // $ stats = $ html- & gt; Search ('div [class ='. Hash. ']'); Statistics stats; ? & Gt; What I want to be able to do is add the hash to the URL which goes to stats.php. There is no code because I am using simple HTML DOM parser. I pass that hash to the stats.php URL to look through the URL. Hope this helps ... ...
When you generate HERF, urlencode in PHP Use to be part of a hash when the user clicks on the link, then the browser is not abandoned:
index.php:
Then on the second page, part of the hash outside the URL.
stats.php:
< Code> & lt; php Include_once ('simple_html_dom.php'); $ Url = $ _GET ['url']; $ Parars_url = parse_url ($ url); $ hash = $ parse_url ['piece']; $ Html = file_get_html ('' $ Url. ''); // $ stats = $ html-> Search ('div [class = fullStats]', 3); $ Stats = $ html- & gt; Search ('div [ Class = ' $ Hash. ']');); Stats Statistics;? & Gt;
No comments:
Post a Comment