473,670 Members | 2,447 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing values to another script using CGI

Without creating a form, how do i pass a value to another script?

I would like to pass:

group = "Oranges"

to another script or at least just 'group' and initialize it in the
first script.

script1:
'''
<html>
<form method=POST action=script2. py>
<input type=submit yada yada>
group = "Oranges"
'''

script2:

print ''' Oh you like '''+group+'''.' ''

thanks,

Mike

Jul 18 '05 #1
1 4200
Hello Mike,

Mike Wimpe wrote:
Without creating a form, how do i pass a value to another script?

I would like to pass:

group = "Oranges"

to another script or at least just 'group' and initialize it in the
first script.

Do you want to pass it *from* a CGI script or *two* a CGI script.

If you are calling a remote script (and if you're not it's an odd
question !) then you can just build the query manually.

(When you hit submit the browser builds a request query from the values
in the form. All you need to do is generate the query yoruself instead
of having hte browser do it).

In order to do this you need to understand how parameters are passed to
a CGI script. It can be done either using the 'GET' method or the
'POST' method and the values need to be properly escaped.

The urllib.urlencod e function will take a dictionary of parameters and
values and return a query string. If you use urllib2.urlopen to fetch
http://www.someserver.com/cgi-bin/yourscript.py + '?' + query_string
then your CGI will be called with the relevant parameters.

Regards,

Fuzzy
http://www.voidspace.org.uk/python/cgi.shtml

script1:
'''
<html>
<form method=POST action=script2. py>
<input type=submit yada yada>
group = "Oranges"
'''

script2:

print ''' Oh you like '''+group+'''.' ''

thanks,

Mike


Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
27644
by: Phillip Wu | last post by:
Hi, I saw a previous post about sending arrays but did not quite understand the answers. The problem is that I would like to pass an entire array as a hidden input field from one php script to another. I've simplified the code where form1.php calls form2.php when "Go" is hit: form1.php
2
3524
by: Xerxes | last post by:
Hi, how can I pass the returned value from Javascript to PHP? I have: ------------------------------------------------------------------------ ------ if ( x>y) {
4
3476
by: Andy R. | last post by:
Hello everyone, I've spent quite some time now, looking for some information on how to get this done, sadly none has helped me much, though. I have a bit of java scrpt on a webpage (.php) to aquire the screen resolution of the visiting user. Now I need to pass the java variable to another variable on the same document. I have a feeling, this will not be easy - as java is client- and php server-sided. Now, if my assumption is corect,...
12
6536
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
3
14929
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) { document.images.src = eval("mt" +menu+ ".src") } alert("imgOff_hidemenu"); hideMenu=setTimeout('Hide(menu,num)',500);
6
364
by: Newbie | last post by:
How do I pass string values from one webform to another?
1
11858
by: | last post by:
Hi, 1st, I did a search and could not find any info on this, the Google results were good, but I'm still have issues...So any help will be great. I have a frame page, which contains 3 frames (Left, Content, and Footer) In the content page, I have a checkbox, which value is a number (i.e. 500). I would like that, when a user clicks on this checkbox, it will send the value to my LEFT frame. My left frame has an array, where I'm going to...
4
4157
by: moondaddy | last post by:
I have a htm page where I need to pass some data to an aspx page as a means of sending data to the database. I don't need to see the aspx page so I was going to put it in a hidden iframe. This works real good. Since I don't need the aspx page to do any postback, is there a way to pass a parameter to it with out it finishing the round trip back to the htm page? Thanks. -- moondaddy@newsgroup.nospam
3
2477
by: Archanak | last post by:
Hi, Any limits exists while passing values of checkbox to another program? Here is the code: <script type="text/javascript"> function valuate() {
0
8469
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8814
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7419
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4211
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4391
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2800
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1794
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.