Creating Simple Contact Form - SWiSHMax Tutorials
 
  Buy Ebooks, Video Games, DVDs, Electronics and more !
Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads Make Money Online Blog . Free Image and Photo Sharing and Hosting

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Free image hosting
   Web Design Pakistan
   Swish Templates
   SWiSH Climax
   Talkfreelance Community
   Template Desire
   Lite boards
   Script Sector
   GimpTalk
   13dots
   Idea Designs
   PHP Cafe
   Sposatoettore
   Free swishmax templates
   Swishzone

Manage your site with Flax Article Content Management System
Creating Simple Contact Form
Category : SWiSHMax | Level : Intermediate | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

This tutorial will demonstrate how to make a very simple contact form using SWiSH MAX.

Level : Intermediate

I assume that you can make input boxes and know how to use variables.
If you dont know how to use variables and how to make input boxes then
please read the following tutorial before reading this tutotial.

Inputbox to TEXT file
and
Varables

STEPS TO BE PERFORMED
---------------------------------

1. Make 4 input boxes with the following variable names
nameVar
emailVar
subjectVar
msgVar


2. Make a dynamic text box which will display status and errors with variable name
errormessage

3. Make a button with name Clear Form and paste the following code
on its action.

on (release) {
nameVar="";
emailVar="";
subjectVar="";
msgVar="";
}

This will clear all the text you have entered in your input text boxes.

4. Make a button with name Send and paste the following code on
its action.

on (release) {
if((nameVar=="")||(emailVar=="")||(subjectVar=="")||(msgVar=="")){
errormessage="Please fill all the fields";
}
else {
errormessage="Sending....";
send="yes";
this.loadVariables("contact.php",'POST');
nameVar="";
emailVar="";
subjectVar="";
msgVar="";
}
}


DESCRIPTION

A. Explanining this part of code
if((nameVar=="")||(emailVar=="")||(subjectVar=="")||(msgVar=="")){
errormessage="Please fill all the fields";
}


This part of the code checks wether all input boxes are filled or not. In the above
code we have used || logical operator.
For more details about logical operators please read the following tutorial.
Read Tutorial

B. Explaining the following part of code.

else {
errormessage="Sending....";
send="yes";
this.loadVariables("contact.php",'POST');
send="no"
nameVar="";
emailVar="";
subjectVar="";
msgVar="";
}


errormessage="Sending...."; = this line will display the message until your email
has been sent.
send="yes"; = in this line we are putting a new value "YES" to SEND variable, we are
doing this becuase we will check this variable in our PHP file, that is SEND button pressed and all fields were given, if so then send email to the given email address in contact.php file.

this.loadVariables("contact.php",'POST'); = in this line we are loading variables from/to contact.php file which we will be making in our next step. It will send variables (name,email,subject and message) to that PHP file.


5. On frame number 1 of your main time, put the following code on its action

onFrame (1) {
nameVar="";
emailVar="";
subjectVar="";
msgVar="";
}

This means that there is no text in your input text boxes when you see your movie for the first time.

*Everywhere you placed some code on an object (texbox) don't forget to checkmark the TARGET box !

6. Open notepad or any text editor and paste the following code into it

<?
if ($send=="yes") {
$to = "YouName@YourDomain.com";
$subject = "$subjectVar";
$body .= "$msgVar";
$from = "$nameVar";
$tfrom = "From: <$emailVar>";
mail($to,$subjectVar,$msgVar,$tfrom);
}
echo "&errormessage=Email has been sent&";
?>


save this file as contact.php.

here is the preview of the example included in this tutorial
user posted image


NOTE : Dont forget to change the email address in CONTACT.PHP file.
Just input your email address, replace YouName@YourDomain.com with yuor email address.

YOU ARE DONE !
Save you SWI file to contact.swf and export it. Upload contact.swf, contact.html and contact.php to any directory and check it.

REMEMBER : You can use it in any level, means in any sprite or sub sprite. It will work fine.

Download Example File

if you have any questions, please feel free to ask and discuss. I hope this is really handy tutorial can is useful.
best regards
Ali Roman..


© 2002-2005 Flaxweb Network | Article Manager | Gimp Tutorials Library | RAD C++ Library | Free C/C++ Sourcecode |
Sites of interest : Web Design Blog | Swish Templates | Swishmax Ebook | Photoshop Templates | Gimp Tutorials | Text Forum | Make Money Online