Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: URL in Form Results  (Read 3102 times)

0 Members and 1 Guest are viewing this topic.

Dale S

    Topic Starter


    Starter

    URL in Form Results
    « on: May 31, 2008, 11:42:00 PM »
    I have the same form on numerous URLs.  I need to know which URL was used when a person enters information in the form. Can the URL be included in the form results?  If so how would you do that?

    Astoria



      Intermediate

      Re: URL in Form Results
      « Reply #1 on: June 01, 2008, 06:55:53 AM »
      yes you can, with PHP.

      What I would do is add the following code to each page:

      Code: [Select]
      <?
      $url = $_SERVER['SERVER_NAME'];
      $page = $_SERVER['php_SELF'];
      ?>

      Than add a hidden field to each form (so the user won't see it):
      Code: [Select]
      <input type="hidden" name="page_url" value=""http://".$url.$page">

      That way you know from what URL each form was submitted.



      Dale S

        Topic Starter


        Starter

        Re: URL in Form Results
        « Reply #2 on: June 01, 2008, 11:53:14 PM »
        I tried your solution but I can't get it to work.  The hidden field works fine if I replace the value=""http://".$url.$page" with something like value="test" so it has to be something in the code.

        Astoria



          Intermediate

          Re: URL in Form Results
          « Reply #3 on: June 02, 2008, 12:14:43 AM »
          try:

          Code: [Select]

          <input type="hidden" name="page_url" value=\"http://.$url.$page\">



          Dale S

            Topic Starter


            Starter

            Re: URL in Form Results
            « Reply #4 on: June 05, 2008, 04:46:58 PM »
            That doesn't work either.  The results information always shows " \"http://.$url.$page\" ".