Hi, All:
I really enjoy this board and gald to see many smart people around to share their knowledge. I am a PHP newbie and need some help:
Basically, I have a template page I want to use as part of my effort to present a uniform look and feel. There are local and outgoing links in my template. When user clicks an outgoing link, I have a PHP script (a browser-like simulator/processor, "Snoopy" from Monte Ohrt <monte@ispi.net>, open source) to fetch the content and merge that with my template so user can still access my other links. (This is a workaround of frame-based pages which I don't like).
I have achieved my goal partially. The links inside the content I feteched may represent relative paths or forms. For relative paths (such as those in href/img src), I prepend them with my fetching script then the host url and they work fine.
Now comes the hard part, forms. My idea is to replace the action value with my fetching script url and add a hidden input value that represents the original action value but fully qualified. All these can be processed inside the fetching PHP script.
Here is what I mean:
before change:
<FORM ACTION="BookPrices.asp" METHOD=GET
id=form1 name=form1>
after change:
<FORM ACTION="my_fetching_script" METHOD=GET
id=form1 name=form1>
<input type="hidden" name ="link" value="some_bookstore/BookPrices.asp">
This way, the fetching script can obtain the necessary values in order to get and merge the content.
My question is what's the easiest/fastest way to obtain the orginal action value. I have tried using preg_match multiple times or using preg_split. I am sure there is a better solution out there. Thanks for any suggestion.
:-)