PHP Add Query to a Link

Part of: PHP Actions

Versions

Pro Only

Description

In order to pass a variable from one page to another, you need to send it as a query on a link; you may have seen URLs like this: http://www.mydomain.com/index.php?variable=1

Most e-commerce sites do this in one form or another. There are two actions for this effect. One for images and one for text.

Application

This Action is applied to an image. Select the graphic you want to apply the link to, and select it from the Actions sub-menu in the Item menu. You can add PHP variables if the action is contained within a PHP Block Action. Each line is a new query. The ? and & between each query is created by the Action.

The PHP Text Link With Query is applied differently, but the Actions Palette works in the same way to the PHP Add Query to Link Action.

This Action is applied within the text flow.

Use Insert>Action to find it. Enter the text that you want to be used as a link in the My Text field. The URL is a normal drop-down of all the pages in the site.

Code Produced

<a href="testpage.php?myVariable=1&myNewVariable=$count" onfocus="blur();">
<img src="Resources/testpa1.gif" border="0" width="108" height="29" alt="">
</a>

And the text link Action:

<a href="testpage.php?myVariable=1&myNewVariable=$count">This is the text for the link</a>

  Register or log in to add tags

Register or log in to view or add comments.

FreewayTalk

Join the friendliest community on the Net at FreewayTalk. Ask and answer questions about Softpress Freeway, or just gather around the virtual water cooler!