Results 1 to 2 of 2

Thread: Text box and hyperlink

  1. #1

    Thread Starter
    Hyperactive Member cajsoft's Avatar
    Join Date
    Aug 2000
    Location
    Glasgow, Scotland
    Posts
    295

    Question Text box and hyperlink

    Hello,
    I'm a complete noob when it comes to PHP.

    however, I have a text box which enables the user to enter a number. I the user then clicks a hyperlink. I would like to send the results from the text box to the hyperlink. i.e.

    Code:
    <input type="text" name="T1" size="2"></td><td><a href="Results.php?MatchUpdNo=T1">test</a>
    Can this be done with out a submit button?

    Regards,
    Craig.
    Craig Johnstone, MCP,CNA

    VB 6,SQL,Lotus Notes,Crystal Reports 7,8

    http://www.cajsoft.co.uk/downloads.htm

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Text box and hyperlink

    With PHP? No. But, you can use JavaScript to accomplish it. Put this into a blank HTML file and see how it works.. is that what you wanted?

    Code:
    <form name="f">
    <script>
    <!--
    function qs(el) {
      if (window.RegExp && window.encodeURIComponent) {
        var qe=encodeURIComponent(document.f.q.value);
        if (el.href.indexOf("q=")!=-1) {
          el.href=el.href.replace(new RegExp("q=[^&$]*"),"q="+qe);
        } else {
          el.href+="&q="+qe;
        }
      }
      return 1;
    }
    // -->
    </script>
    <input name="q" value="">
    </form>
    <a href="index.html?q=" onClick="return qs(this);">asasd</a>
    Like Archer? Check out some Sterling Archer quotes.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width