Page 2 of 2

Re: Any ideas on what my PHP file should look like...

Posted: Thu Jul 11, 2013 10:26 pm
by raemay
but have also tried this:

on sendMail
if the hilite of button "IAgree" then
put empty into myFormData
put libUrlMultipartFormData(myFormData, \
"rcpnt" & ("~@~.com"), \
"subj","LoanApp", \
"cu",(the selectedText of button "CUlist"), \
"mn",(field "MembNmbr"), \
"ff",(field "FirstField"), \
"lf",(field "LastField"), \
"tf",(field "teleField"), \
"af",(field "AltField"), \
"ef",(field "EmailField"), \
"if",(field "IncomeField")) \
into myError
if myError is empty then
set the httpHeaders to line 1 of myFormData
post line 2 to -1 of theFormData to URL "~://~.~/downloads/App/App.php"
put the result into rslt
if rslt is empty then
beep
answer information "Submitted successfully"
else
beep
answer rslt
end if
else
beep
answer error "Can't submit data because of error:" && myError
end if
end if
end sendMail

<?php
$rcpnt="rachel@oaktreebiz.com";
$subj=$_POST["subj"];
$cu=$_POST["cu"];
$mn=$_POST["mn"];
$ff=$_POST["ff"];
$lf=$_POST["lf"];
$tf=$_POST["tf"];
$af=$_POST["af"];
$ef=$_POST["ef"];
$if=$_POST["if"];
$s=" "; //space
$msg=$cu.$s.$mn.$s.$ff.$s.$lf.$s.$tf.$s.$af.$s.$ef.$s.$if;

$header = "MIME-Version: 1.0\r\n" .
"Content-type: text/plain; charset=latin-1\r\n" .
"\r\n";

$rslt = mail($rcpnt,$subj,$msg,$header);
if (!$rslt)
echo 'An error occurred';
else echo 'Mail sent';
?>

Re: Any ideas on what my PHP file should look like...

Posted: Sat Jul 13, 2013 6:48 pm
by Mark
Hi Rae,

I have made a few small corrections to my original script. This is the new LiveCode script:

Code: Select all

on sendMail
   if the hilite of button "IAgree" then
      put empty into myFormData
      put libUrlMultipartFormData(myFormData, \
            "rcpnt", ("recipient@economy-x-talk.com"), \
            "subj","LoanApp", \
            "cu",(the selectedText of button "CUlist"), \
            "mn",(field "MembNmbr"), \
            "ff",(field "FirstField"), \
            "lf",(field "LastField"), \
            "tf",(field "teleField"), \
            "af",(field "AltField"), \
            "ef",(field "EmailField"), \
            "if",(field "IncomeField")) \
            into myError
      if myError is empty then
         set the httpHeaders to line 1 of myFormData
         post line 2 to -1 of myFormData to URL "http://economy-x-talk.com/rae/rae.php"
         put the result into rslt
         put the urlResponse
         if rslt is empty then
            beep
            // answer information "Submitted successfully"
         else
            beep
            // answer rslt
         end if
      else
         beep
         answer error "Can't submit data because of error:" && myError
      end if
   end if
end sendMail
This is the PHP script:

Code: Select all

<?php
$rcpnt = $_POST['rcpnt'];
$subj = $_POST['subj'];
$cu = $_POST['cu'];
$mn = $_POST['mn'];
$ff = $_POST['ff'];
$lf = $_POST['lf'];
$tf = $_POST['tf'];
$af = $_POST['af'];
$ef = $_POST['ef'];
$if = $_POST['if'];
$s = ' ';
//space
$msg = $cu . $s . $mn . $s . $ff . $s . $lf . $s . $tf . $s . $af . $s . $ef . $s . $if;
$header = "From: Your Name <mail@economy-x-talk.com>\r\n" . "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=latin-1\r\n" . "\r\n";

$rslt = mail($rcpnt, $subj, $msg, $header);
if (!$rslt)
    echo "An error occurred in: $msg\r\n$rcpnt\r\n$subj";
else
    echo 'Mail sent';
?>
and this is the script without From header:

Code: Select all

<?php
$rcpnt = $_POST['rcpnt'];
$subj = $_POST['subj'];
$cu = $_POST['cu'];
$mn = $_POST['mn'];
$ff = $_POST['ff'];
$lf = $_POST['lf'];
$tf = $_POST['tf'];
$af = $_POST['af'];
$ef = $_POST['ef'];
$if = $_POST['if'];
$s = ' ';
//space
$msg = $cu . $s . $mn . $s . $ff . $s . $lf . $s . $tf . $s . $af . $s . $ef . $s . $if;
$header = "MIME-Version: 1.0\r\n" . "Content-type: text/plain; charset=latin-1\r\n" . "\r\n";

$rslt = mail($rcpnt, $subj, $msg, $header);
if (!$rslt)
    echo "An error occurred in: $msg\r\n$rcpnt\r\n$subj";
else
    echo 'Mail sent';
?>
All tested and approved ;-)

Kind regards,

Mark

Re: Any ideas on what my PHP file should look like...

Posted: Mon Jul 15, 2013 7:19 pm
by raemay
Awesome! Works perfectly. Thank you so Much Mark. All this you did on a Saturday and everything. I am so thankful. I bet this will come in handy for many users.
Sincerely,
Rae

Re: Any ideas on what my PHP file should look like...

Posted: Mon Jul 15, 2013 7:23 pm
by raemay
Is there a way I can give you any "kudos" Mark? You have made made my week.

Re: Any ideas on what my PHP file should look like...

Posted: Wed Jul 17, 2013 12:25 am
by Mark
Hi Rae,

I'm happy to help, it wasn't that difficult actually. Just... if you like my explanations, perhaps you'd like my book as well ;-)

Kind regards,

Mark