Update PHP Code of Flash Online Form

Discussion in 'PHP' started by ireshsl, May 16, 2012.

  1. #1
    Hey Guys,

    Our hosting guys going to upgrade PHP to it's latest stable version of all of their web hosting servers. According to them there is a risk of stop working outdated PHP scripts after this upgrade. So I need to update PHP codes of our Flash forms that we use on our websites before the upgrade. But I am new to PHP.

    So can you please help me to update PHP code below to it's latest syntax ?.

    Expect your kind support solve this problem.

    Thank you in advance !,
    Iresh.



    PHP Code

    <?
    
    $ToEmail = "you@yourdomain.com";
    $ToSubject = "Inquiry from yourdomain.com";
    
    $EmailBody = "Inquired by: $_POST['fName']\nCompany: $_POST['fCompany']\nCountry: $_POST['fCountry']\nEmail: $_POST['fEmail']\nTelephone: $_POST['fTelephone']\nFax: $_POST['fFax']\n\nMessage: $_POST['fMessage']\n\n\n";
    
    $EmailFooter="\nThis message was sent by: $_POST['fName'] from $REMOTE_ADDR If you feel that you recieved this e-mail by accident please forward to you@yourdomain.com";
    
    $Message = $EmailBody.$EmailFooter;
    
    mail($_POST['fName']" <".$ToEmail.">",$ToSubject, $Message, "From: "$_POST['fName']" <"$_POST['fEmail']">");
    
    
    Print "_root.EmailStatus=Completed - Your inquiry has been sent";
    
    ?>
    Code (markup):

    Flash Code

    else {
    		loadVariablesNum("contact.php", "0", "POST");
    		EmailStatus = "Sending your inquiry. Please wait...";
    		fName = "";
    		fCompany = "";
    		fCountry = "";
    		fEmail = "";
    		fTelephone = "";
    		fFax = "";
    		fMessage = "";
    		EmailStatus = "";
    	}
    Code (markup):
     
    ireshsl, May 16, 2012 IP
  2. rainborick

    rainborick Well-Known Member

    Messages:
    424
    Likes Received:
    33
    Best Answers:
    0
    Trophy Points:
    120
    #2
    I don't see anything in the code you posted that would be affected by a PHP update. The only issue might be in the local function 'loadVariablesNum'. Can you post that code?
     
    rainborick, May 16, 2012 IP
  3. ireshsl

    ireshsl Member

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    38
    #3
    Hi Richard,
    Thank you for your reply. Actually there is a problem with the PHP code because it doesn't use $_POST method. So I have to keep on register_globals feature on. I need to update my entire PHP code using POST method and all other syntax need to be updated according to the latest PHP version. I tried to update it couple of times but couldn't do it because of my lack of PHP knowledge.

    Please refer the Flash code below:

    on (press) {
    	if (!fName.length) {
    		mb._visible=true;
    		mb.setMessage("Please enter your name.");
    		mb.setTitle("ABC Group");
    		
    	} else if (!fCompany.length) {
    		mb._visible=true;
    		mb.setMessage("Please Enter Your Company Name.");
    		mb.setTitle("ABC Group");
    		
    	} else if (!fCountry.length) {
    		mb._visible=true;
    		mb.setMessage("Please Enter your Country.");
    		mb.setTitle("ABC Group");
    		
    	}else if (!fEmail.length || fEmail.indexOf("@") == -1 || fEmail.indexOf(".") == -1) {
    		mb._visible=true;
    		mb.setMessage("Please enter a valid E-mail.");
    		mb.setTitle("ABC Group");
    		
    		} else if (!fTelephone.length) {
    		mb._visible=true;
    		mb.setMessage("Please Enter Your Telephone No.");
    		mb.setTitle("ABC Group");
    	
    		
    	} else if (!fMessage.length) {
    		mb._visible=true;
    		mb.setMessage("Please Enter your Message.");
    		mb.setTitle("ABC Group");
    		
    	} else {
    		loadVariablesNum("contact.php", "0", "POST");
    		EmailStatus = "Sending your inquiry. Please wait...";
    		fName = "";
    		fCompany = "";
    		fCountry = "";
    		fEmail = "";
    		fTelephone = "";
    		fFax = "";
    		fMessage = "";
    		EmailStatus = "";
    	}
    }
    
    Code (markup):
     
    ireshsl, May 16, 2012 IP