Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 01-08-2004, 09:05 AM   #1
Flashchick
Registered User
 
Join Date: Nov 2003
Location: London
Posts: 100
Question send variables to cgi via getURL

Hi all and Happy new year,

I am trying to access a cgi script (search engine, that has been written ages ago and used to accessed by html form. I have no knowledge of cgi) by sending variables from flash.
Flash movie sits in the top frame and has a search box. The result should be displayed at the bottom frame once the search button is pressed.
The fields that was in the old HTML form were called 'terms' and 'hits'. My search box name in Flash is called search and this is my code:

getURL ("http://www.mysite.co.uk/search.cgi?terms='"+search+"'&hits=10","bottomfram e", "POST" );

The cgi script does display the right page on the right frame but it tells me that no search term has been provided.

I think I have to use getURL rather than send variables command as I want to display the cgi script in a different frame.

Does anyone done anything similar or have idea how to do this?

Thanks for your help



Flashchick is offline   Reply With Quote
Old 01-08-2004, 09:12 AM   #2
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Howdy...

I'd love to try it out myself... Any chance you can make a sample with all the scripts???
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-08-2004, 09:33 AM   #3
Flashchick
Registered User
 
Join Date: Nov 2003
Location: London
Posts: 100
Default

all I have is a flash movie that has a text field and a button. two frames in html and then the cgi. I am afraid that I can't give you the cgi script as it is not mine.
It should be very straight forward but I have no idea how to send the variables to the cgi.
Flashchick is offline   Reply With Quote
Old 01-08-2004, 09:39 AM   #4
CyanBlue
Super Moderator
 
CyanBlue's Avatar
 
Join Date: Jan 2002
Location: Centreville, VA
Posts: 26,666
Default

Well... That's fine then...

I cannot really tell you what's going on in your file cuz I cannot see it, but what you have in the getURL() line looks good to me...
But you mentioned that you were using 'terms' and 'hits' in your old HTML page, yet you are using 'search' in the Flash movie... Maybe you could fiddle with that to see if that works or not???

Good luck...
__________________
CyanBlue / Jason Je / Macromedia Certified Flash Developer & Designer
http://CyanBlue.FlashVacuum.com
http://www.FlashVacuum.com
http://tutorials.FlashVacuum.com

Do NOT PM, Email or Call me... Your question belongs right in this forum...
CyanBlue is offline   Reply With Quote
Old 01-08-2004, 10:25 AM   #5
Flashchick
Registered User
 
Join Date: Nov 2003
Location: London
Posts: 100
Default

Here is the original html form: (i did remove some rows to make it easier to read)

<FORM ACTION="http://www.mysite.com/search.cgi" METHOD=POST>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="341">


<TR>
<TD><IMG SRC="images/table_r2_c1.gif" WIDTH="6" HEIGHT="30" BORDER="0"></TD>
<TD><INPUT TYPE=TEXT NAME="terms" SIZE=40 VALUE=""></TD>
<TD><IMG SRC="images/table_r2_c7.gif" WIDTH="2" HEIGHT="30" BORDER="0"></TD>
</TR>

<TR>
<TD><IMG SRC="images/table_r2_c1.gif" WIDTH="6" HEIGHT="30" BORDER="0"></TD>
<TD><SELECT NAME="hits">
<OPTION>10
<OPTION SELECTED>25
<OPTION>50
<OPTION>100
</SELECT></TD>
<TD><IMG SRC="images/table_r2_c7.gif" WIDTH="2" HEIGHT="30" BORDER="0"></TD>
</TR>

<TR>
<TD><IMG SRC="images/table_r2_c1.gif" WIDTH="6" HEIGHT="30" BORDER="0"></TD>
<TD>
<INPUT TYPE="submit" VALUE="Search"></TD>
<TD><IMG SRC="images/table_r2_c7.gif" WIDTH="2" HEIGHT="30" BORDER="0"></TD>
</TR>

</TABLE>
</FORM>

the 'terms' is the fieldname that i am passing and 'serach' is just the text field in Flash. That should make any difference what it is called.
Any other ideas?

Thanks
Flashchick is offline   Reply With Quote
Old 01-08-2004, 03:22 PM   #6
freddycodes
Master of Nothing
 
Join Date: Dec 2002
Location: San Diego, CA
Posts: 2,468
Default

The thing is you specify POST in your getURL but you are in actuality sending GET varaible. My guess is the receiving script is looking for POST variable not GET variables. How about

ActionScript Code:
lv = new LoadVars(); lv.terms  = search; lv.hits = 10; lv.send("http://www.mysite.co.uk/search.cgi","bottomframe", "POST");

That should make your attempt actually send your data via the POST protocol.
freddycodes is offline   Reply With Quote
Old 01-09-2004, 05:58 AM   #7
Flashchick
Registered User
 
Join Date: Nov 2003
Location: London
Posts: 100
Thumbs up

Thanks, that worked.
Flashchick is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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 Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:29 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.