Skip to main content
Known Participant
October 1, 2009
Question

Passing an identifier using hyperlink

  • October 1, 2009
  • 1 reply
  • 1482 views

Hello;

I am at a loss. I fogot how to be able to pass a simple peramiter using a hyper link back to it's self on the same page. I also need the code that it activates only to activate if the link is used. How do I do this using a hyper link? I know how to use forms like this.

This is how the link works if I use another page to activate the code:

applysetting.cfm

<cfif IsDefined("deactivate")>
<cfcookie name="#deactivate#" value="Off" expires="never"><!--- <cookie defined - stop music> --->
<cflocation url="index.cfm" addtoken="no">
<cfelseif IsDefined("engage")>
<cfcookie name="#engage#" value="temp" expires="NOW"><!--- <cookie removed music is on> --->
<cflocation url="index.cfm" addtoken="no">
</cfif>

index.cfm

<a href="apply-setting.cfm?engage=hitbox">Sound On</a>

or

<a href="apply-setting.cfm?deactivate=hitbox"><strong><u>Sound Off</u></strong></a>

I am trying to make it work on one page:

index.cfm

<head>

<cfif IsDefined("deactivate")>
<cfcookie name="#deactivate#" value="Off" expires="never"><!--- <cookie defined - stop music> --->
<cfelseif IsDefined("engage")>
<cfcookie name="#engage#" value="temp" expires="NOW"><!--- <cookie removed music is on> --->
</cfif>

</head>

<body>

<a href="index.cfm?engage=hitbox">Sound On</a>

or

<a href="index.cfm?deactivate=hitbox"><strong><u>Sound Off</u></strong></a>

</body>

as it sits right now, it doesn't work properly.How can I adjust this so I can just make it load the one page and not the applysetting.cfm to make it work?

Thank you

    This topic has been closed for replies.

    1 reply

    Inspiring
    October 2, 2009

    Look at the address bar of your browser for an example.

    Known Participant
    October 2, 2009

    So how owuld I write my if statement for activating the code using this? index.cfm?deactivate=hitbox that was copied from my url. It seems to fire to turn off my app, but not to turn it on.

    October 2, 2009

    Something very similar was discussed here:

    http://forums.devshed.com/coldfusion-development-84/deleting-cookie-not-working-345115.html


    (see end of post)