in reply to Re: funky URLs
in thread funky URLs

i'm not sending the info using a form. all the values are being sent with a link.

Replies are listed 'Best First'.
Re: Re: Re: funky URLs
by gryphon (Abbot) on Jun 30, 2001 at 00:52 UTC

    Well, you didn't specify this in your original post. OK, fine. Here's a solution: Put your params that you need for the CGI into a series of hidden form fields. Then call a form submit from your link via a JavaScript call.

    <HTML><HEAD><TITLE>Some Page</TITLE> </HEAD><BODY bgcolor="#ffffff"> <FORM name=theform method=post action="/cgi-bin/script.cgi"> <INPUT type=hidden name=ID value=1> <INPUT type=hidden name=NAME value=ME> <INPUT type=hidden name=YOU value=YOU> <INPUT type=hidden name=HIM value=HIM> </FORM> <P>Here's a <A href="javascript:document.theform.submit();">link</a> for you.</P> </BODY></HTML>

    -gryphon

    Update: It was pointed out to me that not everyone uses JavaScript, and not everyone can use it. So this won't be an option that works perfectly for everyone, but it's all I could think of...

      javascript is not up to par for creating a link.

      personally, when I see one I turn up my nose and go to another site. javascript only works right for navigational enhancements attached to images that are also normal links.

      but, if it's in a link, and you don't want them to change the values, and you need the values in your script, maybe a local config file would be a better approach? If you use mod_perl you can use fake url directories as keys into your config files, if you need to have different settings based refering site.

      and at that point, it's really easy to just tuck the config into a database instead of in files.
      --
      Snazzy tagline here

Re: Re: Re: funky URLs
by Anonymous Monk on Jun 30, 2001 at 00:51 UTC
    You're asking how to send parameters with a url without sending them in the url. The question makes no sense. Either use a form with method="post", or pass the parameters in the url. There is no way to pass parameters without passing them!
Re: Re: Re: funky URLs
by RatArsed (Monk) on Jul 02, 2001 at 13:20 UTC
    URLs of the form: http://www.local-angle.com/album/index.cgi?topn=40 Are equivelent to the request generated by:
    <form action="http://www.local-angle.com/album/index.cgi" method="get" +> <input type="hidden" name="topn" value="40"> <input type="submit">

    Because of the properties of an anchor (<a>), it will always do a GET, as it has no form information to POST.

    The solutions to your problem are:

    1. Live with it
    2. Use forms, instead of anchors

    --
    RatArsed