Stand Still Posted October 11, 2007 Share Posted October 11, 2007 OK, I'm a fetus when it comes to php stuff...but being a web designer I'd like to start down the road with it...so here goes. I've been using php for email forms on a few of the sites I make. I was told the php code but not why/how it works. This is the code I have on my submit button inside of a Swishmax (.swf) file on (release) { Name = userName.text; Email = userEmail.text; Message = userMessage.text; loadVariables("contact.php",'POST'); then this is the code in the "contact.php" file: <?php $name = $HTTP_POST_VARS['Name']; $email = $HTTP_POST_VARS['Email']; $message = $HTTP_POST_VARS['Message']; $message = stripslashes($message); $sendTo = "myemail@myemail.com"; $subject = "Message from my email"; $msg_body = "Name: $name\n"; $msg_body .= "E-Mail: $email\n"; $msg_body .= "Comments: $message\n"; $header_info = "From: ".$name." <".$email.">"; mail($sendTo, $subject, $msg_body, $header_info); ?> This works Beautifully! BUT, when I use the following code for an estimate form it doesn't work: (from the submit button) on (release) { Business = userBusiness.text; Phone = userPhone.text; Email = userEmail.text; WebAddress =""; WebSite = userWebSite.text; loadVariables("web_estimate.php",'POST'); } (the " WebAddress =""; " is seeking a "yes" or "no" elsewhere in the form from a radio button, and I'm not sure this is even right...just a guess. this is the script that it should recieve its answer from:) onEnterFrame() { radio_button_1.useHandCursor = false; radio_button_2.useHandCursor = false; if (option1=="false") { option_1._visible=false; } if (option2=="false") { option_2._visible=false; } if (option1=="true") { option_1._visible=true; WebAddress="Yes"; } if (option2=="true") { option_2._visible=true; WebAddress="No"; OK, so this is the web_estimate.php that is supposed to convert the variables to my email address but doesn't work (except the business variable does work) <?php $business = $HTTP_POST_VARS['Business']; $phone = $HTTP_POST_VARS['Phone']; $email = $HTTP_POST_VARS['Email']; $webaddress = $HTTP_POST_VARS['WebAddress']; $website = $HTTP_POST_VARS['WebSite']; $message = stripslashes($message); $sendTo = "myemail@myemail.com"; $subject = "Web Estimate Form from Stand Still Designs"; $msg_body = "Business: $business\n"; $msg_body .= "Phone: $phone\n"; $msg_body .= "Email: $email\n"; $msg_body .= "WebAddress: $webaddress\n"; $msg_body .= "WebSite: $website\n"; $header_info = "From: ".$name." <".$email.">"; mail($sendTo, $subject, $msg_body, $header_info); ?> So, I'm quite sure someone can tell me HOW to fix this, but I'd like to know WHY the fix works. Specifically, how the different info in the php files relates to the variables from the .swf file (highlighted in red, green, purple below). <?php $name = $HTTP_POST_VARS['Name']; $email = $HTTP_POST_VARS['Email']; $message = $HTTP_POST_VARS['Message']; $message = stripslashes($message); $sendTo = "myemail@myemail.com"; $subject = "Message from my email"; $msg_body = "Name: $name\n"; $msg_body .= "E-Mail: $email\n"; $msg_body .= "Comments: $message\n"; $header_info = "From: ".$name." <".$email.">"; mail($sendTo, $subject, $msg_body, $header_info); ?> I know that's a lot of info, but its been my experience that too much will retrieve a better answer than not enough. Thanks so much for your help! God bless. Quote Link to comment https://forums.phpfreaks.com/topic/72794-php-forms/ Share on other sites More sharing options...
MadTechie Posted October 11, 2007 Share Posted October 11, 2007 BUT, when I use the following code for an estimate form it doesn't work: (from the submit button) on (release) { Business = userBusiness.text; Phone = userPhone.text; Email = userEmail.text; WebAddress =""; WebSite = userWebSite.text; loadVariables("web_estimate.php",'POST'); } (the " WebAddress =""; " is seeking a "yes" or "no" elsewhere in the form from a radio button, and I'm not sure this is even right...just a guess. this is the script that it should recieve its answer from:) Erm.. no your setting WebAddress to nothing.. i don't know actionscripts that well but this will always set it to nothing you need to pull the value from the form, like this Business = userBusiness.text; or with options maybe move the options code in.. ie if (option_2._visible=true) { WebAddress="No"; } Quote Link to comment https://forums.phpfreaks.com/topic/72794-php-forms/#findComment-367130 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.