POSTING vars into CGI script

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

POSTING vars into CGI script

Post by a94060 »

How can i pass a value from a php script? I am passing the value using a hidden field. What is some sample syntax i can use?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: POSTING vars into CGI script

Post by volka »

I don't understand
a94060 wrote:How can i pass a value from a php script?
This is the question. And
a94060 wrote:I am passing the value using a hidden field.
that's one possible solution to let a browser pass a parameter to a cgi script.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

ok,well,i mean,how can i get the value in perl. I post it using a hidden field,how can i access it?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

have you atleast googled?
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

ok,so according to the first link, if you do POST,it still passes it on the URL? i tried the example, and the query string comes back. Im pretty sure that post doesnt work like that (in all the time i ever used it). Could someone just show me a simple example?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

ok,so according to the first link, if you do POST,it still passes it on the URL?
eh... no. First link for me is http://www.sp.uconn.edu/~jrifkin/cgi-bin/argtest/ and it doesn't tell anything about "it still passes it on the URL" for post data.
It says

Code: Select all

#  Read POST variables into %arg
for (split /\&/, <STDIN>) {
   ($key,$val) = split /=/;
   $val =~ s/+/ /g;
   $val =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;
   $arg{$key} = $val;
}
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

ah well,i probably was reading the wrong part. i tried the post example and it gave out :
Data read from Perl <STDIN> (POST Method):
box1=132jg1h&box2=513541&submit1=Submit+POST

oh well,guess the answer was right there,im kinda bored of it now,so i guess some other time ill get back to it.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

Since we've already provided you with urls to documentation about perl/cgi programming.. here are a couple of links (the last ones from me, i'm bored of people that don't do their homework...): http://www.perl.com/doc/FAQs/cgi/perl-cgi-faq.html and http://www.cgi101.com/book/.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

look man,i know,you know,the rest of the community knows that GOOGLE has the answer. If we all know,then WHY IS THIS FORUM MADE? It is made for those who are not as godly users at google as you are. I am just asking for a simple example, and your saying it as if i am asking YOU personally to help me. if you do not want to give it,DONT GIVE IT,im sure there is someone else out of the million other users who can give help to me. I have lately been relizing that only the moderators end up giving answers like RTFM or google it,why is this? I am starting something new,i know there is google,i can reinvent the wheel if i want to. Heck,i bet everything in this forum is probably somewhere on the internet. This is just my view,i have been seeing that now people are starting to play god and taking time to post remarks such as just google it,or read the manual.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

You've been given links to examples though...
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

allright,fine whatever,i guess your right. i typed into the forum search for "google" and around 2900 results came up.-.- Hopefully people are getting help cause im about to leave. I feel like everytime i come to ask a question its like "Have you googled?" Well,no but...we all dont know what terms to put into google to find what we need.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

a94060 wrote:allright,fine whatever,i guess your right. i typed into the forum search for "google" and around 2900 results came up.-.- Hopefully people are getting help cause im about to leave. I feel like everytime i come to ask a question its like "Have you googled?" Well,no but...we all dont know what terms to put into google to find what we need.
If typing opening google and performing a search is too hard then that is a shame. I'm sorry you feel this way. Just for your information, the FIRST result in the google query I provided answered your question completely. I fail to see how "giving answers like RTFM or google it" is a bad thing, when it is exactly what you are looking for.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

well,i mean,if 99% the answers are going to RTFM or google it,why wouldnt devnetwork just have a nice html page saying "Please Read the Fine Manual or Google it,Thanks" That would probably cut off like 9000 posts out of the forums. Whatever,i dont want to argue with gurus,so i will just leave it.
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

a94060 wrote:well,i mean,if 99% the answers are going to RTFM or google it,why wouldnt devnetwork just have a nice html page saying "Please Read the Fine Manual or Google it,Thanks" That would probably cut off like 9000 posts out of the forums. Whatever,i dont want to argue with gurus,so i will just leave it.
By accusing our moderators and/or members of "starting to play god" or whatever, I think it is only fair I defend my stance and why we do things. Please read the first item in our Posting Guidelines. I would like to remind you that we are all volunteers, and by not bothering to research things for yourself you are not showing us the curtosy of spending our valuable time on this forum. Having the curtosy to attempt to solve this problem for yourself is all we ask. If I think someone was too lazy to type in a few keywords into google then I think it's fair to point them to google. If they provide a more complex question that cannot be easily explained by google, then that is when we will provide more insightful answers.
User avatar
a94060
Forum Regular
Posts: 543
Joined: Fri Feb 10, 2006 4:53 pm

Post by a94060 »

allright then,since i cannot abide by these guidlines,i guess i will just leave then. Just because you are a voulenteer doesnt mean you need to post in the thread i make. im pretty sure there is someone who may be able to give a more helpful answer or explain what i am asking for. There is no moderator rule that says,once you open a thread,you need to post.

Nice knowing who ever i knew
Post Reply