Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Coding Forum


You are currently viewing our Coding Forum as a guest. Please register to participate.
Login



Reply
Passing parameters via POST that's not supplied by the user
Old 09-03-2010, 04:05 AM Passing parameters via POST that's not supplied by the user
Tarianna's Avatar
Junior Talker

Posts: 4
Name: Marion
Trades: 0
Ok, I had trouble describing what I'd like to do. Let me try that again.

This is the series of steps (simplified) that I've done so far:

1. User inputs an item number
2. My CGI Script queries the database and returns a set of results which is stored into a array of hash vars.
3. Results are displayed in a table <- stuck here

I want to sort the columns so I'm thinking I'd turn the column names into submit buttons then send the hash (where the results are stored) and sort/display what's been passed. However, I don't know how to pass the results hash to another cgi using post. I've been successful with using anchors and passing it thru with simulating the GET action (i tack info to the URL) but I'm pretty sure my hash won't pass that way very nicely. I'd rather try passing it via the POST method but I haven't been able to find a clear example on the web how to do that.

The examples I've read all accept input from the user before posting but what if I already have the data that I need already?

I'm using CGI, perl and html templates. I'm a newbie at this and feeling a bit overwhelmed right now.

Any help is appreciated.

Tarianna
Tarianna is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-03-2010, 08:25 AM Re: Passing parameters via POST that's not supplied by the user
Novice Talker

Posts: 7
Trades: 0
Any Variable you want to add to post variables can be through form elements.
You can use the hidden input box to pass any other variable not submitted by the user
__________________

Please login or register to view this content. Registration is FREE
Johnta is offline
Reply With Quote
View Public Profile
 
Old 09-03-2010, 09:20 AM Re: Passing parameters via POST that's not supplied by the user
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
I moved this from the HTML forum because it has to do with programming not HTML.

When I do this with PHP, I use the cURL extension. cURL (libcurl) is an extension that is available for many programming languages, including Perl: http://curl.haxx.se/libcurl/perl/ Whether this is available to you will depend on the host machine.

I'm not a Perl expert, but this Google search may help you if you can't make cURL work for whatever reason: http://www.google.com/search?q=perl+http+post
__________________
Join me on
Please login or register to view this content. Registration is FREE
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 09-03-2010, 02:15 PM Re: Passing parameters via POST that's not supplied by the user
Tarianna's Avatar
Junior Talker

Posts: 4
Name: Marion
Trades: 0
Thank you very much for your replies. I am sorry I posted this in the wrong section.

I'll look at the suggested websites you directed me to.

The question that I have here is: what variables gets passed when a post is issued? Will all the variables that have a value be passed (that was initialized by way of the script that called my template or user) be passed via POST or do just the variables within the form tags get passed? (it might be time for me to play mad web scientist and experiment a bit. )

If anyone knows the answer right off, I'd appreciate your words of wisdom, else I'll let you know how it turns out.

-t
Tarianna is offline
Reply With Quote
View Public Profile
 
Old 09-05-2010, 08:55 AM How to pass an array of hash from tmpl to cgi script?
Tarianna's Avatar
Junior Talker

Posts: 4
Name: Marion
Trades: 0
I thought I'd share the results of my experimentation of today's exploration of passing parms from form to cgi script.

I discovered a few things:
1. You can piece together templates in one script. wowee..now I know how to make consistent headers/footers and all kinds of stuff!

2. Passing a single value is easy, I used form and multiple selects. Assigned diff values to each select (so now i can determine what the user wants). I also used the hidden field attribute to set hidden values..very cool.

And this updates my problem to...how to send an array from html to cgi script. The syntax is hanging me up. I know how to send an array from cgi to html (a ton of examples out there) but very few examples how to go the other way.

And so...my adventure in experimenting with passing parms with cgi scripts continues..oh boy!
Tarianna is offline
Reply With Quote
View Public Profile
 
Old 09-05-2010, 11:14 AM Re: Passing parameters via POST that's not supplied by the user
Tarianna's Avatar
Junior Talker

Posts: 4
Name: Marion
Trades: 0
omg..I figured it out! Finally!

And the answer is so simple. Assign the values (whether hidden or not) within a <form> tag and if multiple values are assigned to the same variable, it becomes transformed automatically into a hash.

Lol..sometimes previous experience of prior computer languages can hinder one's learning. I am too used to having to declare a variable's attributes and it being that static attribute throughout the program. In this way, perl is beautiful (at least for this.)

whee! Now onward..to pagination.
Tarianna is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Passing parameters via POST that's not supplied by the user
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28154 seconds with 12 queries