Link to home
Start Free TrialLog in
Avatar of rbugo
rbugoFlag for Australia

asked on

how to create "action" file for online form

Hi There,

I've created a form on my website so people can contact me. But I get this error message:
Method Not Allowed
The requested method POST is not allowed for the URL /internal pages/contact us.htm.
I think it is because I have not specified an "action" or pointed to an executable file. The field is blank in "action". I don't know how to do this. Is it a script that I need to point it to. Where do I find this script or do I need to create it, if so, how. I'll attach the code of the forms page below.

Thanks
Rob

<html>
<head>
<link href="../style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {text-decoration: none}
a:visited {text-decoration: none}
a:active {text-decoration: none}
a:hover {text-decoration: underline}
-->
</style>
 
<title>X Fitness Solutions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#333333" link="#0000FF" vlink="#FF00FF" alink="#FF0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" width="771" style="border-collapse: collapse" bordercolor="#111111">
      <!-- fwtable fwsrc="template-46.png" fwbase="index.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
      <tr> 
        <td width="157" bgcolor="#7E8079"><img src="../images/spacer.gif" width="134" height="1" border="0"></td>
        <td width="17"><img src="../images/spacer.gif" width="15" height="1" border="0"></td>
        <td width="51"><img src="../images/spacer.gif" width="44" height="1" border="0"></td>
        <td width="360"><img src="../images/spacer.gif" width="309" height="1" border="0"></td>
        <td width="20"><img src="../images/spacer.gif" width="17" height="1" border="0"></td>
        <td width="167"><img src="../images/spacer.gif" width="121" height="1" border="0"></td>
      </tr>
      <tr> 
        <td colspan="6" bgcolor="#000000"> <table width="100%" height="136" border="2" cellpadding="1" cellspacing="3" bordercolor="#FFFFFF" id="AutoNumber4" style="border-collapse: collapse; border-width: 0">
            <tr> 
              <td height="122" background="../images/banner%20white%20scaled.gif" style="border-style: none; border-width: medium">&nbsp;</td>
            </tr>
          </table></td>
      </tr>
      <tr bgcolor="#000000"> 
        <td height="18" colspan="6"> 
          <p align="center" style="margin-right: 7"><FONT face=Verdana color=#ffffff size=1><a href="../index.htm">Home</a> 
            | <a href="contact%20us.htm">Contact Us</a> | <a href="free_newsletter.htm">Free 
            Newsletter</a> | <a href="../PT%20Video%20Clips.htm">PT Clips</a> 
            | <a href="tell%20a%20friend.htm">Tell a Friend</a> | <a href="../before%20and%20after.htm">Before 
            &amp; After</a> | <a href="../testimonials.htm">Testimonials</a></FONT></td>
      </tr>
      <tr> 
        <td width="157" valign="top" bordercolor="#333333" bgcolor="#000000"> 
          <div align="center"> 
            <center>
              <table width="100%" height="98" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
                <tr> 
                  <td height="27" valign="middle"> <div align="center"><strong><img src="../images/about.gif" width="157" height="30"></strong></div></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"> 
                    <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../what%20were%20about.htm">What 
                    we're about</a></strong></font></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"><font color="#333333">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../benefits.htm">Benefits</a></strong></font></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"> 
                    <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../services.htm">Services</a></strong></font></font> 
                  </td>
                </tr>
              </table>
              <br>
              <table width="100%" height="355" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
                <tr> 
                  <td height="28" valign="middle"> <div align="center"><font color="#FFFFFF"><img src="../images/main.gif" width="158" height="30"></font></div></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"> <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../index.htm">Home</a></strong></font> 
                    </font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"><font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../bio.htm">Bio</a></strong></font></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"> <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../our%20trainers.htm">Our 
                    Trainers</a></strong></font> </font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="../newsletter%20archive.htm">Newsletter 
                    Archive </a></font></strong> <a href="../newsletter%20archive.htm"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><br>
                    &nbsp;& Tips</strong></font></a></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../pricing.htm">Pricing 
                    and Policies</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../referral.htm">Referral 
                    System</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../PT%20Video%20Clips.htm">PT 
                    Video Clips</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../boxmania.htm">Boxmania:<br>
                    &nbspBoxing Bootcamp</a></strong></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../articles.htm">Articles</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../train%20the%20trainer.htm">Train 
                    the Trainer</a></strong></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../before%20and%20after.htm">Before 
                    &amp; After</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../testimonials.htm">Testimonials</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../video%20testimonials.htm">Video 
                    Testimonials</a> </strong></font> </td>
                </tr>
              </table>
              <table width="100%" height="4%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
                <tr> 
                  <td height="17">&nbsp;</td>
                </tr>
                <tr> 
                  <td height="35"><img src="../images/products.gif" width="158" height="33"></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="training%20diary.htm">Food 
                    &amp; Training Diary</a></strong></font></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="smoothies%20for%20athletes.htm">Smoothies 
                    e-book</a></strong></font></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"><font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Online 
                    Store</strong></font> </font></td>
                </tr>
              </table>
              <table width="100%" border="0" cellpadding="1" cellspacing="2" bordercolor="#000000">
                <tr> 
                  <td height="10">&nbsp;</td>
                </tr>
                <tr> 
                  <td><img src="../images/free%20downloads.gif" width="157" height="30"></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    e-Books&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Reports&nbsp;&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Software&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Forms&nbsp;&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
              </table>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
            </center>
          </div></td>
        <td colspan="5" bgcolor="#000000" valign="top"> <table width="100%" height="1073" border="0" cellpadding="4" cellspacing="4" bordercolor="#111111" id="AutoNumber6" style="border-collapse: collapse; border-width: 0">
            <tr> 
              <td width="100%" height="1065" valign="top" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"> 
                <div align="center"> 
                  <p>&nbsp;</p>
                  <p><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><img src="../images/contact%20us.jpg" width="111" height="89">&nbsp;&nbsp; 
                    </strong></font></p>
                  <p><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>To 
                    Contact Us</strong></font></p>
                  <p align="center"><strong>We are always interested in hearing 
                    your comments or questions.<br>
                    Please use the form below to send us an email.</strong></p>
                  <form action="" method="post" name="contactUsForm" id="contactUsForm">
                    <blockquote> 
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Your 
                                Name</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Your 
                                Email Address</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield2" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message 
                                Subject</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield3" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message:</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p name="textarea" cols="45" rows="10"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <textarea name="textarea" cols="45" rows="10"></textarea>
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <blockquote> 
                                <blockquote> 
                                  <blockquote> 
                                    <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                      <input type="submit" name="Submit" value="  Send Message  ">
                                      </font></div>
                                  </blockquote>
                                </blockquote>
                              </blockquote>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                      </table>
                      <p>&nbsp;</p>
                    </blockquote>
                  </form>
                </div>
                <blockquote> 
                  <div align="left"> 
                    <p><strong><img src="../images/mail.jpg" width="104" height="99"><br>
                      By Mail:</strong></p>
                    <p><strong>X Fitness Solutions<br>
                      PO Box CP282 <br>
                      Condell Park NSW 2200</strong></p>
                    <p><strong><img src="../images/phone.jpg" width="124" height="124"></strong></p>
                    <p><strong>Phone: 0411 437 907</strong><br>
                    </p>
                  </div>
                </blockquote>
                <div align="center"> 
                  <p>&nbsp; </p>
                </div>
                <blockquote> 
                  <blockquote> 
                    <blockquote> 
                      <div align="left"></div>
                    </blockquote>
                  </blockquote>
                </blockquote></td>
            </tr>
          </table></td>
      </tr>
      <tr bgcolor="#000000"> 
        <td height="29" colspan="6"> 
          <div align="center"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../index.htm">Home</a> 
            | Search |<a href="contact%20us.htm"> Contact Us</a> | <a href="tell%20a%20friend.htm">Tell 
            a Friend</a> | <a href="privacy%20policy.htm">Privacy</a></strong></font></div></td>
      </tr>
      <tr bgcolor="#000000"> 
        <td colspan="6"> <div align="center"><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Copyright 
            &copy; 2004-2008 Xfitness.com.au &#8226; All Rights Reserved </font><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">&#8226;</font></FONT> 
            <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Reproduction 
            without permission prohibited<br>
            &nbsp;&nbsp;<br>
            </font></FONT><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Website 
            designed and maintained by Robbie Bugo</font><br>
            <br>
            </FONT></div></td>
      </tr>
    </table>
  </center>
</div>
</body>
</html>

Open in new window

Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Hi rbugo,

What scripting language will you be using?
Avatar of rbugo

ASKER

Hi Jason,

I'm not sure. I'm new to Dreamweaver, so I don't know much about scripting. What do you suggest. This is a basic website to promote my Personal Training business. What do most people use as a scripting language and do people mix various languages.

Rgds
Rob
Hi Rob,

>> What do you suggest

My personal suggestion is to use PHP, but that's because I'm a PHP developer :)  I also think that DW's support for PHP is better than the other two big languages.

You can use PHP, ASP, or ColdFusion with Dreamweaver and take advantage of the built-in behaviors to automate some form processing.  You need to talk to your ISP to see what they support on the server. PHP is Linux based (normally), ASP is Windows based.  CF can go either way.   That is usually the deciding factor.

>> What do most people use as a scripting language and do people mix various languages.

People use whatever language is available to them from the ISP.  Generally they are not mixed.
Avatar of rbugo

ASKER

Hi Jason,

Thanks for the insight. I have had a look at the Control Panel of my web hosting ISP and it goes something like this:

Apache version 1.3.37 (Unix)
PHP version 5.2.3
MySQL version 4.1.22-standard-log
Architecture i686
Operating system Linux
 
So I guess I need to learn how to use PHP. Can you shed some light into a PHP script to put as the action for my web form.

Cheers
Rob
There are tons and tons and tons of free scripts out there.  Just Google for something like "free PHP form to email" and you will get them all.

The basic method is to point the form action to the php script:

<form action="contact.php" method="post" name="contactUsForm" id="contactUsForm">

and the contact.php page is just a PHP script that take the $_POST array, makes it look nice, and emails you.
Avatar of rbugo

ASKER

Hi Jason,

I sort of understand what you mean. So I need to create a PHP file using a free script. And label it "contact.php" then put that piece of code you provided into the "action" field in Dreamweaver and it should work. I've had a look to find the script in Google but I can only find ones that have the actual form already created. I can't seem to find one that just has the script as I have already created the form. Real sorry, I'm only new to this stuff. I've attached the form code below. Any suggestions are much appreciated.

Rgds
Rob

<html>
<head>
<link href="../style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
a:link {text-decoration: none}
a:visited {text-decoration: none}
a:active {text-decoration: none}
a:hover {text-decoration: underline}
-->
</style>
 
<title>X Fitness Solutions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#000000" text="#333333" link="#0000FF" vlink="#FF00FF" alink="#FF0000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
  <center>
    <table border="0" cellpadding="0" cellspacing="0" width="771" style="border-collapse: collapse" bordercolor="#111111">
      <!-- fwtable fwsrc="template-46.png" fwbase="index.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
      <tr> 
        <td width="157" bgcolor="#7E8079"><img src="../images/spacer.gif" width="134" height="1" border="0"></td>
        <td width="17"><img src="../images/spacer.gif" width="15" height="1" border="0"></td>
        <td width="51"><img src="../images/spacer.gif" width="44" height="1" border="0"></td>
        <td width="360"><img src="../images/spacer.gif" width="309" height="1" border="0"></td>
        <td width="20"><img src="../images/spacer.gif" width="17" height="1" border="0"></td>
        <td width="167"><img src="../images/spacer.gif" width="121" height="1" border="0"></td>
      </tr>
      <tr> 
        <td colspan="6" bgcolor="#000000"> <table width="100%" height="136" border="2" cellpadding="1" cellspacing="3" bordercolor="#FFFFFF" id="AutoNumber4" style="border-collapse: collapse; border-width: 0">
            <tr> 
              <td height="122" background="../images/banner%20white%20scaled.gif" style="border-style: none; border-width: medium">&nbsp;</td>
            </tr>
          </table></td>
      </tr>
      <tr bgcolor="#000000"> 
        <td height="18" colspan="6"> <p align="center" style="margin-right: 7"><FONT face=Verdana color=#ffffff size=1><a href="../index.htm">Home</a> 
            | <a href="contact%20us.htm">Contact Us</a> | <a href="free_newsletter.htm">Free 
            Newsletter</a> | <a href="../PT%20Video%20Clips.htm">PT Clips</a> 
            | <a href="tell%20a%20friend.htm">Tell a Friend</a> | <a href="../before%20and%20after.htm">Before 
            &amp; After</a> | <a href="../testimonials.htm">Testimonials</a></FONT></td>
      </tr>
      <tr> 
        <td width="157" valign="top" bordercolor="#333333" bgcolor="#000000"> 
          <div align="center"> 
            <center>
              <table width="100%" height="98" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
                <tr> 
                  <td height="27" valign="middle"> <div align="center"><strong><img src="../images/about.gif" width="157" height="30"></strong></div></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"> 
                    <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../what%20were%20about.htm">What 
                    we're about</a></strong></font></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"><font color="#333333">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../benefits.htm">Benefits</a></strong></font></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bordercolor="#333333" bgcolor="#FFFFFF"> 
                    <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../services.htm">Services</a></strong></font></font> 
                  </td>
                </tr>
              </table>
              <br>
              <table width="100%" height="355" border="1" cellpadding="0" cellspacing="0" bordercolor="#333333">
                <tr> 
                  <td height="28" valign="middle"> <div align="center"><font color="#FFFFFF"><img src="../images/main.gif" width="158" height="30"></font></div></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"> <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../index.htm">Home</a></strong></font> 
                    </font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"><font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../bio.htm">Bio</a></strong></font></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"> <font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../our%20trainers.htm">Our 
                    Trainers</a></strong></font> </font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<strong><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><a href="../newsletter%20archive.htm">Newsletter 
                    Archive </a></font></strong> <a href="../newsletter%20archive.htm"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><br>
                    &nbsp;& Tips</strong></font></a></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../pricing.htm">Pricing 
                    and Policies</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../referral.htm">Referral 
                    System</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../PT%20Video%20Clips.htm">PT 
                    Video Clips</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../boxmania.htm">Boxmania:<br>
                    &nbspBoxing Bootcamp</a></strong></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../articles.htm">Articles</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../train%20the%20trainer.htm">Train 
                    the Trainer</a></strong></font> </td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../before%20and%20after.htm">Before 
                    &amp; After</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../testimonials.htm">Testimonials</a></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../video%20testimonials.htm">Video 
                    Testimonials</a> </strong></font> </td>
                </tr>
              </table>
              <table width="100%" height="4%" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
                <tr> 
                  <td height="17">&nbsp;</td>
                </tr>
                <tr> 
                  <td height="35"><img src="../images/products.gif" width="158" height="33"></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="training%20diary.htm">Food 
                    &amp; Training Diary</a></strong></font></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="smoothies%20for%20athletes.htm">Smoothies 
                    e-book</a></strong></font></td>
                </tr>
                <tr bordercolor="#333333"> 
                  <td height="25" valign="middle" bgcolor="#FFFFFF"><font color="#333333">&nbsp<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Online 
                    Store</strong></font> </font></td>
                </tr>
              </table>
              <table width="100%" border="0" cellpadding="1" cellspacing="2" bordercolor="#000000">
                <tr> 
                  <td height="10">&nbsp;</td>
                </tr>
                <tr> 
                  <td><img src="../images/free%20downloads.gif" width="157" height="30"></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    e-Books&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Reports&nbsp;&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Software&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
                <tr> 
                  <td height="25" bordercolor="#000000" bgcolor="#FFFFFF">&nbsp;<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Free 
                    Forms&nbsp;&nbsp;&nbsp; <em><font color="#FF0000" size="1">Soon!</font></em></strong></font></td>
                </tr>
              </table>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
              <p>&nbsp;</p>
            </center>
          </div></td>
        <td colspan="5" bgcolor="#000000" valign="top"> <table width="100%" height="1073" border="0" cellpadding="4" cellspacing="4" bordercolor="#111111" id="AutoNumber6" style="border-collapse: collapse; border-width: 0">
            <tr> 
              <td width="100%" height="1065" valign="top" bgcolor="#FFFFFF" style="border-style: none; border-width: medium"> 
                <div align="center"> 
                  <p>&nbsp;</p>
                  <p><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong><img src="../images/contact%20us.jpg" width="111" height="89">&nbsp;&nbsp; 
                    </strong></font></p>
                  <p><font size="4" face="Verdana, Arial, Helvetica, sans-serif"><strong>To 
                    Contact Us</strong></font></p>
                  <p align="center"><strong>We are always interested in hearing 
                    your comments or questions.<br>
                    Please use the form below to send us an email.</strong></p>
                  <form action="" method="post" name="contactUsForm" id="contactUsForm">
                    <blockquote> 
                      <table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Your 
                                Name</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Your 
                                Email Address</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield2" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message 
                                Subject</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                <input name="textfield3" type="text" size="30">
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message:</strong></font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <p name="textarea" cols="45" rows="10"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                </font></p>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr> 
                          <td><blockquote> 
                              <blockquote> 
                                <blockquote> 
                                  <blockquote> 
                                    <div align="left"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> 
                                      <input type="submit" name="Submit" value="  Send Message  ">
                                      <textarea name="textarea" cols="45" rows="10"></textarea>
                                      </font></div>
                                  </blockquote>
                                </blockquote>
                              </blockquote>
                            </blockquote></td>
                          <td>&nbsp;</td>
                        </tr>
                      </table>
                      <p>&nbsp;</p>
                    </blockquote>
                  </form>
                </div>
                <blockquote> 
                  <div align="left"> 
                    <p><strong><img src="../images/mail.jpg" width="104" height="99"><br>
                      By Mail:</strong></p>
                    <p><strong>X Fitness Solutions<br>
                      PO Box CP282 <br>
                      Condell Park NSW 2200</strong></p>
                    <p><strong><img src="../images/phone.jpg" width="124" height="124"></strong></p>
                    <p><strong>Phone: 0411 437 907</strong><br>
                    </p>
                  </div>
                </blockquote>
                <div align="center"> 
                  <p>&nbsp; </p>
                </div>
                <blockquote> 
                  <blockquote> 
                    <blockquote> 
                      <div align="left"></div>
                    </blockquote>
                  </blockquote>
                </blockquote></td>
            </tr>
          </table></td>
      </tr>
      <tr bgcolor="#000000"> 
        <td height="31" colspan="6"> <div align="center"><font color="#FFFFFF" size="1" face="Verdana, Arial, Helvetica, sans-serif"><strong><a href="../index.htm">Home</a> 
            | Search |<a href="contact%20us.htm"> Contact Us</a> | <a href="tell%20a%20friend.htm">Tell 
            a Friend</a> | <a href="privacy%20policy.htm">Privacy</a></strong></font></div></td>
      </tr>
      <tr valign="middle" bgcolor="#000000"> 
        <td height="48" colspan="6"> <div align="center"><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Copyright 
            &copy; 2004-2008 Xfitness.com.au &#8226; All Rights Reserved </font><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">&#8226;</font></FONT> 
            <font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Reproduction 
            without permission prohibited<br>
            &nbsp;&nbsp;<br>
            </font></FONT><FONT 
      face=Verdana color=#FFFFFF size=1><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#FFFFFF">Website 
            designed and maintained by Robbie Bugo<br>
            <br>
            </font> </FONT></div></td>
      </tr>
    </table>
  </center>
</div>
</body>
</html>

Open in new window

I had hoped you would look at some examples and adapt them to your form.  If not, try something like the attached.
<?php
 
$visitor = $_POST['textfield'];
$visitormail = $_POST['textfield2'];
$notes = $_POST['textarea'];
$attn = $_POST['textfield3'];
 
 
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
 
$todayis = date("l, F j, Y, g:i a") ;
 
$attn = $attn ;
$subject = $attn;
 
$notes = stripcslashes($notes);
 
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
";
 
$from = "From: $visitormail\r\n";
 
 
mail("YourEmail", $subject, $message, $from);
 
?>

Open in new window

Avatar of rbugo

ASKER

Hi Jason,
Thanks for the above. But I'm new to this. What do I do, cut and paste the above code into a new file. If so, should I save it in the root directory and make it a PHP file. Do I then point the action to it in DW. Can you step me through it. I've only been using DW for about 6 weeks.
>> What do I do, cut and paste the above code into a new file.

Yes.

>> If so, should I save it in the root directory

Save it to the same directory as the page with the form

>> and make it a PHP file.

Yes

>> Do I then point the action to it in DW

Yes.  Make the form's action point to the above file.

>> I've only been using DW for about 6 weeks.

This isn't so much a Dreamweaver issue as a coding issue.  You need to go through some basic tutorials on using PHP to do various functions.  Once you do that, a lot of what Dreamweaver can do for you becomes a lot clearer.
Avatar of rbugo

ASKER

Thanks Jason..I meant to say that I've only been doing web design for 6 weeks. So the coding is new to me too. I'm guessing that I need to put in my email address in the PHP file where it says "YourEmail". Is there anything else in the PHP file that I need to add apart from this?
Nope, that should do it.  The only other stuff you may want to change is the $_POST['fieldname'] where 'fieldname' is the name of the input elements in the HTML form.  Using textfield, textfield1, textarea isn't a good idea.
Avatar of rbugo

ASKER

Hi Jason, I'm finding it hard to understand what you mean. As I said I'm very new to this stuff. What is the name of an input element. What is an input element? Is it a title for the person's name. I'm really not a computer programmer in any way shape or form.

I tried just putting in my email address. But and tried testing the form but it didn't work. I'm guessing that the PHP file has to somewhat correspond in terms of fields and what not with the form I created in DW. But how is that possible if I just cut and pasted the php code and then tried to link as an action. I have just tried renaming a few things and still nothing. I don't really know what to look for. Any ideas...below is the code for my form and I've pasted in the php with changes as well.

Rob
<form name="form1" method="post" action="../contact.php">
                    <table width="70%" border="0" cellspacing="0" cellpadding="0">
                      <tr> 
                        <td colspan="2"><strong>Your Name</strong></td>
                      </tr>
                      <tr> 
                        <td> <input name="yourname" type="text" size="40"> </td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Your 
                          Email Address</strong></font></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td> <input name="youremail" type="text" size="40"> 
                        </td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message 
                          Subject</strong></font></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td> <input name="subject" type="text" size="40"> 
                        </td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Message</strong></font></td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td> <textarea name="message" cols="60" rows="10"></textarea> 
                        </td>
                        <td>&nbsp;</td>
                      </tr>
                      <tr> 
                        <td><div align="center"> 
                            <input type="submit" name="sendmessage" value="Send Message">
                            &nbsp 
                            <input type="reset" name="reset" value="Reset">
                          </div></td>
                        <td>&nbsp;</td>
                      </tr>
                    </table>
                  </form>
 
---------------------------------------------------------------------
<?php
 
$visitor = $_POST['yourname'];
$visitormail = $_POST['youremail'];
$notes = $_POST['subject'];
$attn = $_POST['message'];
 
 
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
 
$todayis = date("l, F j, Y, g:i a") ;
 
$attn = $attn ;
$subject = $attn;
 
$notes = stripcslashes($notes);
 
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
";
 
$from = "From: $visitormail\r\n";
 
 
mail("rbugo@xfitness.com.au", $subject, $message, $from);
 
?>

Open in new window

Okay, you've changed your form from the first one you posted.

The input elements are the form fields.  Form fields have names:

<input name="youremail" type="text" size="40">
<input name="subject" type="text" size="40">
<textarea name="message" cols="60" rows="10"></textarea>

Those field names populate the $_POST array in PHP with name=>value pairs.  So in the PHP script I gave up, you need to change the $_POST['fieldname'] to match the above fields where appropriate.
Avatar of rbugo

ASKER

Thanks Jason, the form is now working. Took me a while to understand what was going on.

One last thing. Is there a line of code or something I can put in the PHP script which makes it automatically revert back to my webpage after the form has been sent. At the moment when I submit the form it just goes to a blank white page.

Cheers
Rob
ASKER CERTIFIED SOLUTION
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rbugo

ASKER

Hi Jason,
Man, you just did my head in. I tried learning the PHP header stuff and now my brain is fried. And it's Christmas Eve here in Sydney. Didn't understand a thing. Did it the easy way and added html and a link. It's all good now.

I like your style though of trying to make people learn. No wonder you are on top. Thanks again for your patience and help. I'm sure I'll be speaking to you again. Have a great Christmas and New Year.

Rgds
Robbie
Robbie,

Here's the other way to do it:

Add this after the last line in the script:

header("Location: newpage.html");
Avatar of rbugo

ASKER

Thanks man...

Rob