Link to home
Start Free TrialLog in
Avatar of microfleet
microfleet

asked on

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?
Avatar of ozo
ozo
Flag of United States of America image

The simplest way is probably with <input type="hidden">
Avatar of microfleet
microfleet

ASKER

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.
you can set $ENV{QUERY_STRING} and $ENV{REQUEST_METHOD} before calling the second script.
ok, those values are set. How then do I make a direct call to a second script from within my first script?
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.
ASKER CERTIFIED SOLUTION
Avatar of khacharn
khacharn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
thanx micro)for the points.
Could you also post how you Did it..for me..
Thanx
Regards
Nitin
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----