Forum Moderators: open

Message Too Old, No Replies

change text based on previous page link

         

hoju312

9:52 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



I am writing a form for one page with a 6 item drop down list. Once a person clicks on one of the items on the it would take them to the second page which would have unique content based on the item they clicked. The second page would be the same for all six links, but the content would be different. I have no idea how to do this, oh and it has to be for people with cookies turned off.

Is this even possible and if so could someone point me in the right direction?

da644

10:35 pm on Apr 19, 2006 (gmt 0)

10+ Year Member



Hi.

You will need to use a server-side tech. like PHP, ASP or Coldfusion. If you are running off a Linux box you will probably have PHP [url]www.php.net[/url] available and if you are on a Windows box you will probably have ASP available. Once you know what you have available all you need to do if evaluate the form field passed to the page your form submits to and create/include the content required.

Kind regards,

Andrew
<snip>

[edited by: trillianjedi at 7:34 pm (utc) on April 20, 2006]
[edit reason] TOS [/edit]

Trace

6:09 pm on Apr 20, 2006 (gmt 0)

10+ Year Member



You don't have to use a server side language for what you want to do.

You can pass you form info in the url: something.html?dropdown=2

Then on the second page, use a little js function to retrieve the information and then just print to screen depending on the option chosen.

<html>
<head>
<script type="text/javascript">
function getURLParam(strParamName){
var strReturn = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?"));
var aQueryString = strQueryString.split("&");
for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
if (aQueryString[iParam].indexOf(strParamName + "=") > -1 ){
var aParam = aQueryString[iParam].split("=");
strReturn = aParam[1];
break;
}
}
}
return strReturn;
}
</script>
</head>

<body>

<script type="text/javascript">
if(getURLParam('dropdown') == 1){
document.write('blah blah');
}else{
document.write('blah blah blah');
}
</script>

</body>
</html>