/    Sign up×
Community /Pin to ProfileBookmark

submission forms mating with php

first i apologize. i am sure this a sophmore issue, but i figured this was the right place to post due to the fact that i am among professionals. i am attempting to construct javascript that will mate with a php file for a simple web submission form embedded in a flash file. i will post my current if you wish or point me in the right direction of a viable source of information. i have been hunting and hunting an i am having a difficult time finding answers.

any help is greatly appreciated.

troy

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceFeb 17.2006 — So, what is your question?
Copy linkTweet thisAlerts:
@yortauthorFeb 17.2006 — i am looking for the javascript code to place into flash that will load into a php file on the server. all of the input fields are placed. here is my current javascript for the input fields:

// create the LoadVars objects which will be used later

// one to send data...

dataSender = new LoadVars();

// and one to catch what comes back

dataReceiver = new LoadVars();

// DEFINE SUBMIT BUTTON BEHAVIOR

submit_mc.onRelease = function() {

// final check to make sure fields are completed

if (t_2.text != '' && t_3.text != '' && t_4.text != '' && t_5.text != '') {

t_6.text = "";

// clear any previous error messages or warnings

// advance playhead to frame 2 - the "processing" message

_root.play();

// assign properties to LoadVars object created previously

dataSender.name = t_2.text;

dataSender.email = t_3.text;

dataSender.subject = t_4.text;

dataSender.message = t_5.text;

dataSender.field_1 = t_6.text;

// callback function - how to handle what comes back

dataReceiver.onLoad = function() {

if (this.response == "invalid") {

_
root.gotoAndStop(1);

alert_txt.text = "Please check email address - does not appear valid.";

} else if (this.response == "error") {

_root.gotoAndStop(3);

} else if (this.response == "passed") {

_
root.gotoAndStop(4);

}

};

// now send data to script

dataSender.sendAndLoad("processEmail.php", dataReceiver, "POST");

} else {

}

};

in addition, here is the php code. (i know this is a javascript form but i figured i would try)

<?php

$subject = "amvf web contact form.";

$name = $_POST['t_2'];

$email = $_
POST['t_3'];

$message = $_POST['t_4'];

$field_1 = $_
POST['t_5'];

$field_2 = $_POST['t_6'];

$name=trim($name);

$email=trim($email);

$subject=stripslashes($subject);

$message=stripslashes($message);

$field_1=stripslashes($field_1);

$field_2=stripslashes($field_2);


$toaddress='[email protected]';

if (!eregi("^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,3})$", $Email)) {

// return with an invalid address error

}

switch ($valid) {

case 0:

mail($toaddress,$subject,$message,$field_1);

//clear the variables

$name='';

$email='';

$subject='';

$message='';

$field_1='';

$field_2='';

echo 'response=passed';
break;

case 1:

echo 'response=invalid';

break;

case 2:

echo 'response=error';

break;

}//end switch

?>
Copy linkTweet thisAlerts:
@phpnoviceFeb 17.2006 — I still don't see a question anywhere. So, you're looking for JavaSript code, but... What kind of code? ...i.e., to do what?

Cheers.
Copy linkTweet thisAlerts:
@yortauthorFeb 17.2006 — i have a submission form on my page with 5 input fields. when the fields are submitted they are passed to a php form where they are sent to a specific email address as a contact form. i have the code roughed in...sort of, but i can't make it run properly. and i cant figure out why.

thanks
Copy linkTweet thisAlerts:
@phpnoviceFeb 17.2006 — Any error emssages? ALso check the site error log for these messages.
×

Success!

Help @yort spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...