1)Select a Submit button in a form.
In the Behaviors panel (Window > Behaviors), click the Plus (+) button, and select Call JavaScript from the list.
In the Call JavaScript box, enter the name of the JavaScript function to run when the user clicks the button, and click OK.
For example, you can enter the name of a function that doesn’t exist yet, such as processMyForm().
If your JavaScript function doesn’t exist in the head section of the document yet, add it now.
For example, you could define the following JavaScript function in the head section of the document to display a message when the user clicks the Submit button:
function processMyForm() {
alert('Thanks for your order!');
}
2)If the standard syntax for a form in HTML (as per w3.org) is:
<FORM action="http://somesite.com/prog/adduser" method="post">
<P>
First name: <INPUT type="text" name="firstname"><BR>
Last name: <INPUT type="text" name="lastname"><BR>
email: <INPUT type="text" name="email"><BR>
<INPUT type="radio" name="sex" value="Male"> Male<BR>
<INPUT type="radio" name="sex" value="Female"> Female<BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</P>
</FORM>
Then on pushing Submit, you will be redirected to http://somesite.com/prog/adduser
Edit accordingly, :-)
3)That can be done simply by adding a php file. Ill give you an example:
HTML CODE
-------------------
<form method="POST" action="contact.php">
<br>
<input name="EmailFrom" type="text" class="green" value="Email Adress Here">
<input name="FirstName" type="text" class="green" value="First Name Here">
<input name="LastName" type="text" class="green" value="Last Name Here">
<p>
<input name="City" type="text" class="green" value="City Here">
<input name="State" type="text" class="green" value="State Here">
<input name="Website" type="text" class="green" value="Website Here">
<br>
<p>
<textarea name="message" class="green">Your Message</textarea>
<input name="submit" type="submit" class="green" value="Submit">
</form>
Notice the post action is to a php file "contact.php" so open a new document in notepad or whatever and put this
PHP CODE
-----------------
<?php
// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['EmailFrom']));
$EmailTo = "YOUR@EMAIL.COM";
$Subject = "message from viewer";
$FirstName = Trim(stripslashes($_POST['FirstName']));
$LastName = Trim(stripslashes($_POST['LastName']));
$City = Trim(stripslashes($_POST['City']));
$State = Trim(stripslashes($_POST['State']));
$Website = Trim(stripslashes($_POST['Website']));
$message = Trim(stripslashes($_POST['message']));
// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
exit;
}
// prepare email body text
$Body = "";
$Body .= "FirstName: ";
$Body .= $FirstName;
$Body .= "\n";
$Body .= "LastName: ";
$Body .= $LastName;
$Body .= "\n";
$Body .= "City: ";
$Body .= $City;
$Body .= "\n";
$Body .= "State: ";
$Body .= $State;
$Body .= "\n";
$Body .= "Website: ";
$Body .= $Website;
$Body .= "\n";
$Body .= "message: ";
$Body .= $message;
$Body .= "\n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
if ($success){
print "<meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\">";
}
else{
print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
}
?>
Save this as contact.php make sure that you change your e-mail adress on the php code.
Also there is an included file "ok.htm" you will need to create so open up a new document in notepad or whatever and type something like "Your message sent" and save it as "ok.htm" then just upload the 3 files to your server and test it =) if you have any questions feel free to contact me at