Jump to content
Sign in to follow this  
troy

methods for processing form data?

Recommended Posts

Hi All

First off hope everybody had a great xmas and all the best for the new year.

As resolutions go making a new website ain't exactly great but I've hit a snag - got most of the graphics I need and how to make them into a page in dreamweaver sorted out but for the life of me (and a lack of understanding code at all)I don't know which action or server-side script I need to process the data entered into my form and hopfully send to me via email.

I know this is very technical stuff but in the past folks from here have solved other problems in a language even I can understand so am hoping some one knows.

It really is'nt an emergency to have a form on the site but some one told me that it enables those poeple who use external email to send a message to me (i.e don't write emails with outlook express etc but use AOL or something)

Cheers for any help

Paul

Share this post


Link to post
Share on other sites

Paul,

Dreamweaver may not be the best tool for you if you have no idea what you're doing, which makes me wonder why you acquired it in the first place (cough cough), but you need to use some php or asp to make your form data go through (depending on which one the host you are using is running). If you create a form in html, you need to give your inputs names in which your server side page will request from.

For example:

This is a silly example of a form in html

<form action="my_processing_page.php" method="post">My name <input type="text" name="my_name" /> <br />My specialty <input type="text" name="my_specialty" /> <br /><input type="submit" value="Send form" /></form>

The 2 input values you're passing are `my_name` and `my_specialty`. So, using a server side language, you need to request these values and then do something with them. Here's a php example

<?php$my_name = $_POST['my_name'];$my_specialty = $_POST['my_specialty'];// this is your address you want the mail to go to$email = "your_email@mywebsite.com";// the sub of the mail$subject = "Mail from my cool new site";// what the mail should contain$message = "Someone sent you some mail. They said their name was " . $my_name . " and their specialty is " . $my_specialty . ". Weeeee! ";// who should it look like the mail was from? If you use their email, you can just hit reply and send them a reply (since we didn't ask for it on the form, we'll just make one up for now).$from = "my_mailman@mywebsite.com";// send it off!mail($email, $subject, $message, $from);?>

There are some other specifics involved, like adding extra header info which some hosts require, but this is the basic workflow.

Hope it helped!

Share this post


Link to post
Share on other sites

Cheers Dickf

Well it could be I'm chewing more then I should at again - I use PS,Ai and ID alot as it is for graphic stuff and seeing as DW came with the package I thought I'd try it instead of the netobjects I've used in the past. Admitingly there is alot more code word involved which even I have understood thus far but must admit the code you showed me could very well be klingon? Will see when the time comes if I'll do my own or cheat and use the template my web-host provides.

cheers again

Troy

Share this post


Link to post
Share on other sites

Troy, a friend of mine just got DW and part of her "self-training" are training videos she is finding on the net. She started with a Google search and never looked back. G'luck

Share this post


Link to post
Share on other sites

I use PS,Ai and ID alot as it is for graphic stuff and seeing as DW came with the package I thought I'd try it instead of the netobjects I've used in the past. Admitingly there is alot more code word involved which even I have understood thus far but must admit the code you showed me could very well be klingon?

I see - I use the same software for work. Most people that use DW get it from a friend or ahem, 'borrow' it, if you know what I mean. It's not cheap, and to not know how to code anything wouldn't make sense to buy it. I reread my post and it sounded a little crass - sorry about that. There are several free alternatives to Dw that are really great. One is Notepad++.

Don't be afraid to learn - you can do this if you have been putting together your own site - especially if you've attained any comfort in the Dw IDE. The code is easy to understand once it's broken down and explained. I assume the code in question is the php, so here you go:

A $ denotes a variable. You can assign it any value you like in the form of a number, string, etc. In my example, I was assigning it the value of the posted value of the form elements.

$myVariable = "Troy";

The above is perfectly acceptable.

In the same example, I think you can see that a . joins strings and variables together. So

// outputs: Hello. My name is Troy.echo "Hello. My name is " . $myVariable;

Finally, the mail function. It's a built-in function specific to the php software installation. It takes these arguments as a minimum:

// "to:", "subject: ", "from: ", "message: "mail("youremail@yourdomain.com", "Website mail", "adifferentEmail@something.com", "Hi. Mail is fun!");

If you need any help with this, I can help you. I've attained lots of help from leather pros on here, so to give back in this way is good with me. See ya around!

Chris

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...