TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 195,856
  • Total Topics: 21,292
  • Online today: 1,096
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 269
  • Total: 269

hyperinking a PHP block back to itself?

Started by pheasant_plucker, August 20, 2009, 08:44:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pheasant_plucker

Is it possible to have a link in a php block refer to the block it's in? I want to have a clickable link which changes a database field depending on the information sent in the header with the link. I can do this by sending the information to a seperate script but I wondered if linking to the same script is possible.

Gerry

ed_m2

do you mean read a value out of the url.. i.e. by using $_REQUEST

or read a value sent from a form.... i.e. by using $_POST

I have used both within a php article, can't see why a php block shouldn't be able to grab the same information as it's all parsed into the same page.

pheasant_plucker

I was using $_GET but what would the href be to link back to itself?

Gerry

ed_m2

for my php article i link back to index.php?page=XXXX

for a block presumably linking back to any page that will contain that block would work ...?
i'm guessing though.

JPDeni

Quotefor a block presumably linking back to any page that will contain that block would work ...?

Yes.

I use this in a block:


  $str = getenv("QUERY_STRING");
  if ($str)
    $action = 'index.php?'.$str;
  else
    $action = 'index.php';


This uses a form and not a link of course, but it's the same idea. The getenv("QUERY_STRING") returns whatever is after the ? in a url (if anything) so that the user will go back to the place where they were, once the link is clicked.

pheasant_plucker

Thanks for the help. JP's solution is just what I need.

Gerry

G6Cad


This website is proudly hosted on Crocweb Cloud Website Hosting.