kevinrea Posted October 1, 2007 Share Posted October 1, 2007 hi guys, i am just starting in php. i am trying to get my swish form to work, when i click the submit, it just says "WAITING FOR BLAH BLAH BLAH WEBSITE" at the bottom of the browser window.. it never really seems to send. my website supports it,.. i am using it in conjunction with a swish form that i made. here is the code behind the submit button on my swish form.. ********************************** on (press) { Name = ClientName.text; ClntEmail = Email.text; ClntAddress = Address.text; ClntCity = ClientCity.text; ClntState = ClientState.text; ClntZipcode = ClientZipcode.text; PropType = PropertyType.text; DesCity = DesiredCity.text; PriceRnge = PriceRange.text; MinBdrooms = MinimumBedrooms.text; MinBthrooms = MinimumBathrooms.text; MinSqFt = MinimumSquareFootage.text; MinLotSze = MinLotSizeAcreage.text; TypeConst = TypeOfConstruction.text; AddComments = AdditionalComments.text; loadVariables("contact.php",'POST'); *********************************** and then , here is the content of my .php file which is called 'contact.php', and it transferred to the website using ASCII, so it wouldn't corrupt it as a binary transfer seems to do.... ************************************** <?php $Name = $HTTP_POST_VARS['Name']; $Email = $HTTP_POST_VARS['ClntEmail']; $Address = $HTTP_POST_VARS['ClntAddress']; $City = $HTTP_POST_VARS['ClntCity']; $State = $HTTP_POST_VARS['ClntState']; $Zipcode = $HTTP_POST_VARS['ClntZipcode']; $PropertyType = $HTTP_POST_VARS['PropType']; $DesiredCity = $HTTP_POST_VARS['DesCity']; $PriceRange = $HTTP_POST_VARS['PriceRnge']; $MinBedrooms = $HTTP_POST_VARS['MinBdrooms'] $MinBathrooms = $HTTP_POST_VARS['MinBthrooms']; $MinSqFoot = $HTTP_POST_VARS['MinSqFt']; $MinLotSize = $HTTP_POST_VARS['MinLotSze']; $AdditionalComments = $HTTP_POST_VARS['AddComments']; $message = stripslashes($AddComments); $sendTo = "ksrea@sbcglobal.net"; $subject = "Message from Contact Form on SearchWestervilleHomes.com"; $msg_body = "Name: $name\n"; $msg_body .= "E-Mail: $email\n"; $msg_body .= "Address: $address\n"; $msg_body .= "City: $City\n"; $msg_body .= "State: $State\n"; $msg_body .= "Zipcode: $Zipcode\n"; $msg_body .= "Property Type: $PropertyType\n"; $msg_body .= "Desired City-Area: $DesiredCity\n"; $msg_body .= "Price Range: $PriceRange\n" $msg_body .= "Minimum Bedrooms: $MinBedrooms\n"; $msg_body .= "Minimum Bathrooms: $MinBathrooms\n"; $msg_body .= "Minimum Square Feet: $MinSqFoot\n"; $msg_body .= "Minimum Lot Size/Acreage: $MinLotSize\n"; $msg_body .= "Additional Comments: $AdditionalComments\n"; $header_info = "From: ".$name." <".$email.">"; mail($sendTo, $subject, $msg_body, $header_info); ?> **************************** any help would be appreciated. Kevin Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/ Share on other sites More sharing options...
trq Posted October 1, 2007 Share Posted October 1, 2007 Firstly, I'm not sure where your learning php from but the $HTTP_POST_VARS[] array has long been depricated in favour of $_POST[]. Secondly, you'll need to check the form was submitted to the page before attempting to assign values to variables from the $_POST[] array. Thirdly, you'll want to wrap your call to the mail() function in a conditional to see if it has succeeded. Try... <?php if (isset(_POST['Name'])) { $Name = $_POST['Name']; $Email = $_POST['ClntEmail']; $Address = $_POST['ClntAddress']; $City = $_POST['ClntCity']; $State = $_POST['ClntState']; $Zipcode = $_POST['ClntZipcode']; $PropertyType = $_POST['PropType']; $DesiredCity = $_POST['DesCity']; $PriceRange = $_POST['PriceRnge']; $MinBedrooms = $_POST['MinBdrooms'] $MinBathrooms = $_POST['MinBthrooms']; $MinSqFoot = $_POST['MinSqFt']; $MinLotSize = $_POST['MinLotSze']; $AdditionalComments = $_POST['AddComments']; $message = stripslashes($AddComments); $sendTo = "ksrea@sbcglobal.net"; $subject = "Message from Contact Form on SearchWestervilleHomes.com"; $msg_body = "Name: $name\n"; $msg_body .= "E-Mail: $email\n"; $msg_body .= "Address: $address\n"; $msg_body .= "City: $City\n"; $msg_body .= "State: $State\n"; $msg_body .= "Zipcode: $Zipcode\n"; $msg_body .= "Property Type: $PropertyType\n"; $msg_body .= "Desired City-Area: $DesiredCity\n"; $msg_body .= "Price Range: $PriceRange\n" $msg_body .= "Minimum Bedrooms: $MinBedrooms\n"; $msg_body .= "Minimum Bathrooms: $MinBathrooms\n"; $msg_body .= "Minimum Square Feet: $MinSqFoot\n"; $msg_body .= "Minimum Lot Size/Acreage: $MinLotSize\n"; $msg_body .= "Additional Comments: $AdditionalComments\n"; $header_info = "From: ".$name." <".$email.">"; if (mail($sendTo, $subject, $msg_body, $header_info)) { echo "Success"; } else { echo "Failed to send mail"; } } ?> Post the results. Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-358909 Share on other sites More sharing options...
kevinrea Posted October 1, 2007 Author Share Posted October 1, 2007 HI Thorpe, thanks for the help. I got the php from being referenced there from some of the folks on the swishzone forum., to this page... http://www.swishzone.com/index.php?area=resources&tab=tutorials&do=page&action=detailed&link_id=152 also, what file sharing properties should the php file have on the server ??? shold it be 0777 ?\ is there any way to check a php script to see if it is really working other than putting it up on the website ? kevin Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-359259 Share on other sites More sharing options...
BlueSkyIS Posted October 1, 2007 Share Posted October 1, 2007 also, what file sharing properties should the php file have on the server shold it be 0777 ? The term is "permissions" and they should be 0755. is there any way to check a php script to see if it is really working other than putting it up on the website ? Not easily. You should develop locally and/or a different location than the live site. Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-359266 Share on other sites More sharing options...
cooldude832 Posted October 1, 2007 Share Posted October 1, 2007 you can detect syntactical errors very easily if you have a pretty print editor as if you have quoted issues, missing semi colon etc it will not color the lines down further. If you aren't using a line number/pretty print editor I suggest you will, it will save you and us lots of time diagnosing silly problems. Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-359274 Share on other sites More sharing options...
trq Posted October 1, 2007 Share Posted October 1, 2007 is there any way to check a php script to see if it is really working other than putting it up on the website Install a webserver locally and develope on that. Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-359277 Share on other sites More sharing options...
kevinrea Posted October 1, 2007 Author Share Posted October 1, 2007 hi thorpe, thanks for your help. i installed web server locally, it is Easy file Sharing Web Server, and i put the pages up there and when i click on the submit button, in the log it says " Post/serverdirectory/contact.php., so, does that mean it is working ok ? thanks, kevin Quote Link to comment https://forums.phpfreaks.com/topic/71316-just-starting-in-php/#findComment-359319 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.