Forum Moderators: phranque

Message Too Old, No Replies

how to write cgi script to access a value from web page

         

emb_prakash

9:29 am on Jul 13, 2005 (gmt 0)

10+ Year Member



Hi,

I want to send a value to a cgi script from a web page.
My html code is : <a href="/cgi-bin/value.sh?9">9</a>. But, I don't know how to write the cgi script to access the value when clicking on "9" (which is showing on the web page). Further I wish to access the value and send to a file say a.txt.

any body help me?

zomega42

1:35 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



Looks like you're trying to use a unix shell script. Why not just use php? In either case, the query string "9" should be available to your script as an environment variable. If you want to stick with a shell script you'll have to look up how to read the environment variables.

emb_prakash

7:21 am on Jul 14, 2005 (gmt 0)

10+ Year Member



Thanks, ok.. the environment variable QURERY_STRING shows my value and it can be displayed on the web page by using echo command. if i write like this:

#!/bin/bash
Content-type:text/plain
echo $QUERY_STRING
echo $QUERY_STRING=/home/username/a.txt

it will only display the query_string on the webpage.
it could not store this value in the a.txt.

what's the wrong in my code. What I have to do.
Please help me.