PDA

View Full Version : Dreamweaver CS3 form assistance required 'SUBMIT button'



lurka
20th March 2008, 07:17 PM
Hey groovers and shakers,

I am n00btastic with DW CS3,

I have composed a form and it looks great,
But How do I tell the submit button where to submit the form goodness to?

I just want it to be sent to an email addy and then have the page redirected to a thank you for submitting page.

I await your assistance.

Cheers

tcn33
20th March 2008, 07:32 PM
You need to add the action into your form tag - the action is where your form submits to. How you generate the email depends on whether you're using HTML or PHP.

I would add an example but it's not easy to write code on an iPhone :p

lurka
20th March 2008, 08:13 PM
Well,
HTML is it, if you dont mind sometime over the easter break that would be great if you could write me an example so I can give it a go myself,

Also... ( there is always an also).....
Making the fields a required field, I have tried, and it adds the error text there normally, rather than after you press the submit button..... any ideas?

adamd
20th March 2008, 08:20 PM
Well,
HTML is it, if you dont mind sometime over the easter break that would be great if you could write me an example so I can give it a go myself,

Also... ( there is always an also).....
Making the fields a required field, I have tried, and it adds the error text there normally, rather than after you press the submit button..... any ideas?

If you're doing it HTML style, you need to use JavaScript, and it opens an email in the default email application.

I prefer PHP. :)

iSilver
20th March 2008, 08:43 PM
When you make a form, you need to send the user data to a server which can process the details and pass them on.

The most popular ways to do this these days are PHP, Perl or maybe MS Frontpage. The ISP hosting your website should be able to guide you here.

Bear in mind that most ISPs who provide you with web access and a homepage site (eg Oputs, Telstra) don't provide access to a scripting engine to allow you to do this, making it impossible to use forms.

You don't need javascript to make a email link open in a mail program, simple HTML is all that is required, eg <a href="mailto:steve@apple.com">Steve Jobs</a>.

HTH

lurka
20th March 2008, 09:06 PM
well if anyone has the time to give me a quick tute over ichat or msn , i'll be here allnight trying to work it out.

TheMountainGoat
20th March 2008, 09:23 PM
Open up Adobe Help Viewer and have a look in there, there is a massive section covering forms! I know that it may sound a little harsh advice, but get in there, most is covered...

Also, Dreamweaver should build the Jscript automatically. Then if you still are stuck after digesting the Dreamweaver help, let me know and I'll build you an example model.

EDIT:- If you are just wanting to create a link, then use this script... <script language="Javascript" type="text/javascript">
var name = "NAME"
var domain = "DOMAIN"
document.write("<a href='mailto:" + name + "@" + domain + "'>")
document.write(name + "@" + domain)
document.write("<\/a>")
</script>

replace the capitalised Name and Domain, with your name and your domain, it stops spambots harvesting your address, but will open up the e-mail for you, when clicked on.

AUSMUG
20th March 2008, 10:01 PM
Below is a rough idea of what you have to do if you choose PHP to process a form. Firstly you will need to add a link to the php form processor in your form action eg


<form action="sendresults.php" method="post" class="content">You then copy the following php code into a blank file and name it say sendresults.php
You will need to enter your own subject name, email address that the form results should be sent to, url pointing to your thank you page and select whether all fields are required or none are required (in the set parameters section.


<?php
//--------------------------Set these paramaters--------------------------

// Subject of email sent to you.
$subject = 'Contact Form';

// Your email address. This is where the form information will be sent.
$emailadd = 'name@domain.com.au';

// Where to redirect after form is processed.
$url = 'http://www.domain.com.au/thankyou.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '0';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>There are heaps of alternative ways to do this but this code should help get you started.

adamd
25th March 2008, 09:23 PM
Below is a rough idea of what you have to do if you choose PHP to process a form. Firstly you will need to add a link to the php form processor in your form action eg

....

There are heaps of alternative ways to do this but this code should help get you started.

This is the easiest way to go... personally, as I do web design for many people... I made a script that allows you to select what is to be shown, and what is required, then prints the form, then sends the results to me...

:)