Forum Moderators: coopster
Is there php code to capture the refering page name e.g. blue-widget.htm and display it in the enquiry form e.g. <? echo: $refpage;?>
Usually I would simply use: <a href="enquire.php?subject=blue-widget">Enquire</a>
However, there is only one copy of the menu for this website, the menu is 'included' in every page, and the menu has the enquire button :(
of the above $_SERVER['HTTP_REFERER'] is the right one if you want to use it on the enquire.php page to find out what the last page was.
$_SERVER['PHP_SELF'] would be right if you wanted to build the link on the page that is linking to enquire.php
either way you will have to chop it up a bit to get what you want
if it is in a menu file, should make it even easier, pass it a value or set up the value before you include the menu.
This sounds good. However, I should have explained a bit more:
- my customer is using a CMS to update/create product pages. To '..pass it a value or set up the value before you include the menu' My customer must add the 'Product name' to new pages.
- The CMS does not display/edit php code.
- I have set .htaccess so .htm pages parse php (the CMS will edit such htm pages but not show/edit php code that is within them).
- The CMS will edit html items e.g. <input type=hidden name="product" value="Blue widget">
If I understand your point: php is parsed before html, so I don't think this will work: <input type=hidden name="product" value="Blue widget">
Is there another way to do that?