You can easily submit values to online scripts using AutoPlay Media Studio. In this example we will build a PHP script to send email, and then setup an AutoPlay Media Studio application to interact with it. The result will be an AutoPlay Media Studio application which can send your information by email. It's easy to do and only takes 3 simple steps.
STEP 1 : CREATE AND UPLOAD YOUR PHP SCRIPT
-----------------------------------------------
Using any text editor (such as notepad) create a blank text file and type the following into the blank document:
Once you have that done, save the document as "mail.php" and upload it to any web server which has PHP installed. if you aren't sure if your web site supports PHP contact your sysadmin for details. If you need a reliable host, the $9/month "4U shared hosting account" at http://www.tera-byte.com is a great value and offers full support for PHP. Once you have mail.php uploaded it's time for step 2.
STEP 2: SETUP YOUR AUTOPLAY MEDIA STUDIO PROJECT
-----------------------------------------------
Either use the attached project or create a blank one. You'll need input fields for your return email address, email subject, and email message. As well you will need a button. The button will contain all the actions for the project. In the attached example I also put in a title and labels so users will know which fields to type into, etc. Once you have your page laid out, you're ready for the final step, adding the code.
STEP 3: ADDING OUR BUTTON CODE
-----------------------------------------------
In this step we add actions to the buttons onClick event. The actions are as follows:
As you can see we first gather the data from the input fields, then we check for "empty field" errors. And in the final step, if there are no errors, we submit the data to our mail.php script from step one. Remember to adjust the action in the attached example if you are using it, to match the web site address where you uploaded your mail.php script.
Well, that's it. Hope this was useful. It's just a simple example. You can easily augment this to return values from the server or mail.php if you like, check out the help file entry for the HTTP.Submit action for details. If you have any questions, just let me know and I'll be happy to assist.
Corey Milner
Creative Director : Indigo Rose Software
STEP 1 : CREATE AND UPLOAD YOUR PHP SCRIPT
-----------------------------------------------
Using any text editor (such as notepad) create a blank text file and type the following into the blank document:
PHP Code:
<?php
// specify recipient email address
$to="TYPE-YOUR-EMAIL-ADDRESS-HERE";
// send our email
mail ("$to","$subject","$body","$from");
?>
STEP 2: SETUP YOUR AUTOPLAY MEDIA STUDIO PROJECT
-----------------------------------------------
Either use the attached project or create a blank one. You'll need input fields for your return email address, email subject, and email message. As well you will need a button. The button will contain all the actions for the project. In the attached example I also put in a title and labels so users will know which fields to type into, etc. Once you have your page laid out, you're ready for the final step, adding the code.
STEP 3: ADDING OUR BUTTON CODE
-----------------------------------------------
In this step we add actions to the buttons onClick event. The actions are as follows:
Code:
-- clear error variable error = 0; -- Get values from input fields from = Input.GetText("Input1"); subject = Input.GetText("Input2"); body = Input.GetText("Input3"); -- check for empty fields and deliver errors if needed if String.Length(from) < 1 then Dialog.Message("Error", "Please enter your email address and re-submit. Thank you."); error = 1; end if String.Length(subject) < 1 then Dialog.Message("Error", "Please enter your email subject and re-submit. Thank you."); error = 1; end if String.Length(body) < 1 then Dialog.Message("Error", "Please enter your email message and re-submit. Thank you."); error = 1; end if error~=1 then -- if no errors exist, send the email now and give a confirmation dialog HTTP.Submit("http://www.yourwebsite.com/mail.php", {from=from, subject=subject, body=body}, SUBMITWEB_POST, 20, 80, nil, nil); Dialog.Message("Success", "Success, your info has been submitted."); Application.Exit(); end
Well, that's it. Hope this was useful. It's just a simple example. You can easily augment this to return values from the server or mail.php if you like, check out the help file entry for the HTTP.Submit action for details. If you have any questions, just let me know and I'll be happy to assist.
Corey Milner
Creative Director : Indigo Rose Software
Comment