Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

new FAQ on forms in FAQ section

Status
Not open for further replies.

davdesign

Technical User
Oct 21, 2000
1,482
0
0
GB
hi all
I've written an FAQ for creating a flash form that does actually work. I've also tested it for flash 4 and 5 so there shouldn't be any compatibility complaints.

All the files discussed can be found at:

If it hasn't been screened and okayed in FAQ by the gurus here yet, then here it is in its glory:
_______________________________________________________
ok here we go:

What you need to know to format this form to your own requirements:

1] Making sure its sent to YOU
2] Adding/changing form input boxes
3] Amending the PHP to suit your new form.

First of all, the best thing to say about the labels and variables not discussed from here on is to just leave them be.
You could easily render the form useless just by tweaking a variable or a label somewhere within the movie. OK.......


1...Making sure its sent to you

In frame 1 of the movie, change the variable addressee to the e-mail address you want to receive the information.
i.e. if you want the form to be sent to jimmy@haggis.com then you change the action to Set Variable: "recipient" = "jimmy@haggis.com"


2...Adding/changing form input boxes

At the moment there are three text input boxes. The top two for 'topic' and 'contact address' are assigned the variables 'subj' and 'mail' respectively. The third 'comment' has the variable 'mess'.
You'll notice that these variables are used in two other places:

>Frame4 'back' button
>davform.php3 file

So, you guessed it, if you want to add more boxes to your form, just assign them variables and add them to the back button and the php3 file. This is easy for the back button because you can simply copy the format already in place.
However for the PHP file its similarly simple but you must be wary of how to do it or your form might fail........


3...Amending the PHP to suit your new form.

This is what the PHP file looks like (you can open it using Notepad):

<?php
mail($addressee, $subj, $mess,
&quot;From:&quot;.$mail.&quot;\nReply-To:&quot;.$mail);
echo(&quot;sent=success&quot;);
?>



The first and last lines act similarly to HTML and ASP, they just let your server know that the script is PHP, so ignore them. The next line tells your server to send the form and all its components. It is this line which you have to amend.
For each additional box you add to the form, you must add the assigned variable to this line. Lets say that you add a box in your form asking for a phone number, you create a text-field in the movie and give it the variable name 'phone'. Then Line 2 of the PHP file would become:

mail($addressee, $subj, $mess, $phone,

So basically, you put a '$' before the new variable (make sure you put a comma after the last variable on this line!!.



And that's it!!! As I mentioned earlier, it would be a good idea for your sake if you left all labels and the undiscussed parts of the PHP well alone. These things are tender, and the slightest typo could ruin it completely (hence the countless entries in forums from people saying that their form doesn't work).
If this form doesn't work for you, the first thing you should do is contact your server and check if PHP can be used on their site. The chances are that your using a freebie server and it doesn't, so I suggest you hitch a ride to www.f2s.com and sign yourself up for a free site which allows PHP. As Oldnewbie pointed out, they don't give you a lot of webspace BUT you don't have to use this as your website host, you only have to use this to store your PHP files.

I hope this form helps everyone and I hate myself already for putting my own e-mail address in the example (should've put Old's in there LOL !!!).
If you are having problems, please don't e-mail me unless it critical, and please be patient if you do.

Cheers for now!!

dave ;-) davdesign@hotmail.com

^^^^^^^^^^^^^^^^
 
BTW... f2s.com is full! Was supposed to have new space today... but it still isn't there!

;-) &quot;If nothing else, I can always serve as a bad example!”

 
ouch

don't know of any others, took me long enough to find that when I needed it. davdesign@hotmail.com

^^^^^^^^^^^^^^^^
 
We ain't supposed to promote anything on this forum anyways!

;-) &quot;If nothing else, I can always serve as a bad example!”

 
if only f2s were paying me for it! davdesign@hotmail.com

^^^^^^^^^^^^^^^^
 
As a useful 'tool' ;-) which can be used to utilise PHP flash support ;-), f2s seems to be accepting new accounts.

As PHP can be used so well with flash as another tool, it might be a good idea to make the most of the opening. You never know when you might need it.

dave

as an example of a PHP script in operation (I also need to check speed) why not click on the 'chat' button at and login as &quot;guest&quot;. dave@davdesign.co.uk

^^^^^^^^^^^^^^^^
 
Yes they are... Did register last Tuesday... Was supposed to receive a confirmation email... Never did! Nor have they responded to my numerous following emails on the subject!
A lot of class!
Maybe their machines were spiked too!

;-) &quot;If nothing else, I can always serve as a bad example!”

 
I thought this might happen to you Old, so I've got a wee haggis-shaped present in the form of an f2s membership, on it's way to you via e-mail.

dave dave@davdesign.co.uk

^^^^^^^^^^^^^^^^
 
Dave, thanks for the form tutorial.....exactly what I needed =)
Cal
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top