Announcement

Collapse
No announcement yet.

Variables from one page to another

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Variables from one page to another

    Hi,

    Does anyone know how to pass variables from a link to another page? I don't want to use a form (I can't because the link will be within another form).

    I can not use a querystring as I will be passing through a description which might be too big, and might also include some &'s. I will be using netquotevars to build the script/href tag on the fly.

    I am wondering if PHP or Javascript could be used?

    Any Ideas?

    Thanks,
    Paul.

    #2
    If the link is within an existing form and you can't easily use a querystring and want to avoid cookies, make the link launch a Javascript function which empties the info into another form, and submits it. At the bottom of the page, add this:

    Code:
    <form name="newForm" method="POST" action="linktopage.htm" style="margin:0px;padding:0px">
    <input type="hidden" name="info" />
    </form>
    obviously changing the 'action' attribute to your destination page. Then put the following as your link:
    Code:
    <a href="javascript:document.newForm.info.value='your NETQUOTEVAR text';document.newForm.submit();return false">Click here</a>
    When clicked, the form info will be available on the destination page. One thing to avoid is any single and double quotes in your NETQUOTEVAR text.
    www.gbradley.co.uk
    Web Development, Actinic Patches, Scripts & more

    Comment


      #3
      Thanks! I will give it a go.

      I have managed to do something with java that generates the popup html on the fly and is called by the link I want (basically its a popup that says "recommend product to a friend", and then the popup is generated with the references etc as part of the html. This is then used with sendmail to email it out.

      I think your way would be more effiecent as there minimal javascript involved and faster as the html is already created.

      Thanks a lot,
      Paul.

      Code:
      <script type="text/javascript">
      <!--
      function recommend_popup(name,desc)
      {
      var generator=window.open('','Recommend This Product','height=135,width=258');
      generator.document.write('<html><head><title>Recommend This Product</title>');
      generator.document.write('<link type="text/css" media="screen" rel="stylesheet" href="actinic.css">');
      generator.document.write('</head><body>');
      generator.document.write('<div style="margin:20px;><form method="post" name="prodrec_form" action="http://www.anything-goes.co.uk/acatalog/sendmail_product_recommend.php"><INPUT TYPE=HIDDEN NAME=ACTINIC_REFERRER VALUE='http://www.anything-goes.co.uk/cgi-bin/bb000001.pl?PRODUCTPAGE=adhesives_oils_and_liquids.html'>');
      generator.document.write('<label for="from">Your Name:</label><br class="caform_br">'); 
      generator.document.write('<input class="caform_text" type=text name="from" value="" size="40">');
      generator.document.write('<label for="to">Your Friends Email:</label><br class="caform_br">'); 
      generator.document.write('<input class="caform_text" type=text name="to" value="" size="40">');
      generator.document.write('<input type=hidden name="name" value="'+ name +'">');
      generator.document.write('<input type=hidden name="desc" value="'+ desc +'">');
      generator.document.write('<input type=hidden name="url" value="'+ document.url +'">');
      generator.document.write('<br class="caform_br"><br class="caform_br">');
      generator.document.write('<input class="ca_submit_right" value="Submit" type="submit">');
      generator.document.write('</form></div>');
      generator.document.write('</body></html>');
      generator.document.close();
      }
      //-->
      </script>

      Comment

      Working...
      X