Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variable passing

Status
Not open for further replies.

kafka

Programmer
Oct 17, 2000
27
US

I have an index page and that page has a hyperlink to another page. If a user click on that link is there any way to pass a variable I set on that first page to the linked page. The point of this is that I have forms that can be entered on the internet by customers and forms entered by employees online. If a "customer" submits a form online I want to set a flag so that the system knows the form was submitted via the internet by a "customer".


I have been able to pass a variable in the hyperlink, but that was only one variable:

href="company_registration.cfm?selection=V3"

Can I add another variable to the href. That would be a easy and quick solution. Are there security issues with this kind of variable passing.

Or is there a way in the form to say that if the form came from the index page set a variable flag.

 
You have two options:

1. Add the second variable to the URL, as you suggest. Your URL will then look something like this:

href="company_registration.cfm?selection=V3&Source=Customer"

In general, when you want to pass more than one variable on the URL, separate them with an &, so you can have

page.cfm?var1=1&var2=2&var3=3&var4=4&var5=5

2. Have a hidden input object on the form (<input type=&quot;Hidden&quot; name=&quot;source&quot; value=&quot;customer/employee&quot;>) and post this with the other form data.

The advantage of the second way is that you do not expose parameters to the user and they dont have any easy way of guessing at other values for your parameters, trying to corrupt your site, or bypass any security you may have depending on these parameters.

Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top