Passing parameters to second script

I have a script that creates a database entry for a new user. After the user has been validated, I create a directory for him or her. So while my first script is meant to create a new user, I have another script which I want to use solely to create the directory.
Here's my question: How do I send these two values, $NEW_USER and $NEW_DIRECTORY_NAME from my first script to my second, and, also, will simply sending these values to the directory-creating script cause the first script to EXIT?
microfleetAsked:
Who is Participating?
 
khacharnConnect With a Mentor Commented:
hi microfleet..
here the answer..i have used this method(it is the only method) for myself..hope it suits you..
i will give you some brief code..
1) Calling program(source.pl)
to execute the target.pl script you will have to write this foll code somewhere in you source.pl script..
****************************************
  start("perl target.pl <parameter>");
****************************************

2) Called program..(target.pl)
In the very beginning of your program you will write this code..  
***************************************
($parameter = $ARGV[0]);
#Now you have the parameter you wanted in your code..
chdir("pathofdirectory");
mkdir("parameter");
**************************************
Hope it helps
Regards
Nitin  
0
 
ozoCommented:
The simplest way is probably with <input type="hidden">
0
 
microfleetAuthor Commented:
I want one script to call another. As far as I know the <input type> is a HTML code. That isnt what I want. After the user has been created, my script should through itself call a second script. It should pass its variables to it. I think by using the REQUIRE statement I can accomplish part of what I want, but there is still a part that I need: I neglected to mention this but the second script needs to be able to read the QUERY_STRING just as if all the form information had been posted to it and not to the first script.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
ozoCommented:
you can set $ENV{QUERY_STRING} and $ENV{REQUEST_METHOD} before calling the second script.
0
 
microfleetAuthor Commented:
ok, those values are set. How then do I make a direct call to a second script from within my first script?
0
 
ozoCommented:
If you want the first script to exit when the second script is done, you can exec it,
if you want to return the the first script after the second script is done, you can call it with system,
if the second script is a perl script, you can do it.
0
 
microfleetAuthor Commented:
Yes your code does fine; however, I figured out a way to do what I want a few days ago. I forgot I still had this posted. But since you did answer the question, and it was helpful, I'm giving you the points.
Thanks.
0
 
khacharnCommented:
thanx micro)for the points.
Could you also post how you Did it..for me..
Thanx
Regards
Nitin
0
 
microfleetAuthor Commented:
khacharn, this is how I POST to a perl script:

'----BEGIN CODE---

Dim Flags As Long, URL as string
Dim TargetFrame As String
Dim PostData() As Byte

URL = "http://www.url.com/cgi-bin/perl.pl"   'You don't need to send a "?"
HEADERS = "Content-Type: application/x-www-form-urlencoded" & vbCrLf

'The ampersands are important!
PostData = "&name=John Doe&email=john@doe.com"

' VB creates a Unicode string by default so you need to
' convert it back to Single byte character set.
PostData = StrConv(PostData, vbFromUnicode)

'send information
WebBrowser.Navigate URL, Flags, TargetFrame, PostData, HEADERS

'---END CODE----
0
All Courses

From novice to tech pro — start learning today.