Hallo,
ik wil een cgi script via een flashformulier benaderen.
Het script staat bij dds
http://www.dds.nl/helpdesk/cat.php?cat=homepage&id=5
De code die ik in flash (as3) heb ziet er zo uit:
en werkt wel in php alleen is dit dus niet bij dds geïnstalleerd.
// MAILFORM VOOR CGISCRIPT
email_txt.restrict = "a-z_.@0-9";
email_txt.maxChars = 40;
realname_txt.restrict = "A-Za-zÁáÉéêíÍãõç ";
realname_txt.maxChars = 40;
boodschap_txt.restrict = "0-9A-Za-zÁáÉéêíÍãõç!?.+\- ";
boodschap_txt.maxChars = 100000200;
comments_txt.onSetFocus = function()
{
status_txt.text = "";
};
email_txt.onSetFocus = realname_txt.onSetFocus = boodschap_txt.onSetFocus;
status_txt.text = "All fields required";
recipient_txt.text = "gebruikersnaam@dds.nl";
subject_txt.text = "Message from website";
submit_btn.onRelease = function()
{
var recipient = recipient_txt.text;
var email = email_txt.text;
var realname = realname_txt.text;
var boodschap = boodschap_txt.text;
var subject = subject_txt.text;
// are all the fields filled?
if (realname == "")
{
status_txt.text = "You need to fill in your Name.";
return;
}
if (email == "")
{
status_txt.text = "You need to fill in your E-mail.";
return;
}
// you should also validate the email address
if (boodschap == "")
{
status_txt.text = "Please, don't forget your Comment!";
return;
}
// yes, all fields filled
sendEmail(recipient,realname,email,boodschap,subject);
// sending data...
status_txt.text = "Processing mail form...";
// prevent submitting again by disabling the button
this.enabled = false;
};
function sendEmail(recipient, realname, email, boodschap, subject)
{
var myData = new LoadVars();
myData.recipient = recipient;
myData.realname = realname;
myData.email = email;
myData.boodschap = boodschap;
myData.subject = subject;
myData.onLoad = function(ok)
{
if (ok) {
status_txt.text = this.message;
} else {
//status_txt.text = "There was an error. Try again later.";
}
submit_btn.enabled = true;
};
myData.sendAndLoad("http://www.dds.nl/cgi-bin/formmail.cgi",myData,"POST");
}
Waardoor het niet werkt ligt volgens mij in de variabele van in post methode van het cgi script nl.
<FORM ACTION="http://www.dds.nl/cgi-bin/formmail.cgi" METHOD="POST"
ENCTYPE="application/x-www-form-urlencoded">
heb ook al deze 2 postoplossingen geprobeerd en beide geven helaas geen resultaat
myData.sendAndLoad("http://www.dds.nl/cgi-bin/formmail.cgi",myData,"POST","application/x-www-form-urlencoded");
myData.sendAndLoad("http://www.dds.nl/cgi-bin/formmail.cgi",myData,"POST",ENCTYPE = "application/x-www-form-urlencoded");
Hopelijk weet iemand raad en alvast bedankt voor het meedenken.