Click to See Complete Forum and Search --> : Problems with posting form


basils57
11-15-2007, 09:50 AM
Hi Folks

I'm having a real problem with posting a form, and would appreciate some help with my coding in DW8.

Currently the form a) won't post and b) won't clear the boxes when the 'clear' button is pressed. After the info has been submitted, the page is supposed to revert to 'thankyou.html' in the same directory.

I've loaded up the actions etc advised by my host company.

I don't know whether I'm doing right, but I'm listing the relevant code from my page below:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<!-- InstanceBeginEditable name="doctitle" -->
<title>Contact Direct Safety Solutions Ltd</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
<style type="text/css">
<!--
.style2 {color: #993330}
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="dss.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#F4FFE4">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#D5EDB3">
<td colspan="3" rowspan="2" valign="middle" bgcolor="#D5EDB3"><img src="images/baselogo110acv5.png" alt="header" width="874" height="114" /></td>
<td colspan="3" rowspan="2" align="center" valign="bottom" nowrap="nowrap" bgcolor="#d5edb3" id="logo"><p>&nbsp;</p>
<p class="pageName style2">&nbsp;</p></td>
<td width="4" height="50">&nbsp;</td>
</tr>

<tr bgcolor="#D5EDB3">
<td width="4" height="51">&nbsp;</td>
</tr>

<tr>
<td colspan="7" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>

<tr>
<td colspan="7" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
</tr>

<tr bgcolor="#99CC66">
<td colspan="7" id="dateformat" height="20">&nbsp;&nbsp;<script language="JavaScript" type="text/javascript">
document.write(TODAY); </script> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
</tr>

<tr>
<td colspan="7" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>

<tr>
<td width="165" valign="top" bgcolor="#5C743D">
<table border="0" cellspacing="0" cellpadding="0" width="165" id="navigation">
<tr>
<td width="165">&nbsp;<br />
&nbsp;<br /></td>
</tr>
<tr>
<td width="165"><a href="index.html" class="navText">home</a></td>
</tr>
<tr>
<td width="165"><a href="benefits.html" class="navText">how we can benefit your business</a></td>
</tr>
<tr>
<td width="165"><a href="action.html" class="navText">how we achieve results</a></td>
</tr>
<tr>
<td width="165"><a href="consultants.html" class="navText">our consultants </a></td>
</tr>
<tr>
<td width="165"><a href="samples.html" class="navText">sample documents </a></td>
</tr>
<tr>
<td width="165"><a href="subscribe.html" class="navText">subscribe </a></td>
</tr>
<td width="165"><a href="javascript:;" class="navText">members area </a></td>
</tr>
<td width="165"><a href="contact.html" class="navText">contact us </a></td>
</tr>
</table>
<br />
&nbsp;
<table width="140" border="0" align="center" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td rowspan="3"><img src="images/110_sfs10.gif" alt="Safety Starts Here Sign" width="110" height="164" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div align="center"><br />
&nbsp;<br />
&nbsp;<br />
</div></td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td colspan="4" valign="top"><!-- InstanceBeginEditable name="body" --><img src="mm_spacer.gif" alt="" width="405" height="1" border="0" /><br />
&nbsp;<br />
&nbsp;<br />
<table border="0" cellspacing="0" cellpadding="0" width="682">
<tr>
<td colspan="2" class="bodyText"><p><span class="pageName">CONTACT US <br />
</span><br />
Contact us using the form below, including any questions or comments that you may have. </p>
<p>Please fill in all applicable details and click the 'Send Enquiry' button to send your request/enquiry to us. </p> </td>
</tr>
<tr>
<td width="276" valign="top" class="bodyText"><form id="form6" name="form6" method="post" action="">
<label for="label">Name*<br />
</label>
<input name="textfield2" type="text" id="label" tabindex="11" size="30" />
<label for="name"><br />
<br />
</label>
<label for="label2">Email*<br />
</label>
<input name="textfield3" type="text" id="label2" tabindex="31" size="30" />
<p>
<label for="label3">Telephone*<br />
</label>
<input name="textfield4" type="text" id="label3" tabindex="61" size="30" />
</p>
<p>
<label for="label5">No. of Employees*<br />
</label>
<input name="textfield6" type="text" id="label5" tabindex="71" size="10" /></p>
</form>
<label for="name"></label>
<p>&nbsp;</p> </td>
<td width="406" valign="top" class="bodyText"><form id="form4" name="form4" method="post" action="">
<label for="company"> Company*</label>
<br />
<input name="company" type="password" id="company" tabindex="21" size="40" />
<p>
<label for="textfield">Address<br />
</label>
<textarea name="textfield" cols="30" rows="5" id="textfield" tabindex="41"></textarea>
</p>
<p>
<label for="label4">Postcode</label>
<br />
<input type="text" name="textfield5" tabindex="51" id="label4" /><label for="textfield"></label></p>
</form> </td>
</tr>
<tr>
<td colspan="2" class="bodyText">
<form action="http://www.directsafetysolutions.co.uk/cgi-sys/formmail.pl" method="post">
<input type="hidden" name="recipient" value="info@directsafetysolutions.co.uk" />
<label for="label6">Any additional enquiries or comments</label>
<br />
<textarea name="textfield7" cols="60" rows="8" id="label6"></textarea>
</form> </td>
</tr>
<tr>
<td colspan="2" class="bodyText"><br />
<input name="Submit" type="submit" class="bodyTextStrong" tabindex="91" value="Submit Enquiry" />
<input type="hidden" name="redirect" value="http://www.directsafetysolutions.co.uk/thankyou.html">
<input name="Submit2" type="reset" class="bodyTextStrong" tabindex="101" value="Clear Form" /></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><br />
<span class="bodyTextStrong">* = Mandatory fields that need to be filled in</span></td>
</tr>
</table>

<div align="center"><span class="smallText">Total Contents copyright &copy; 2007 Direct Safety Solutions Ltd <br />
&nbsp;</span><br />
</div>
<img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /><br />
&nbsp;<br />
<!-- InstanceEndEditable --></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="165">&nbsp;</td>
<td width="50">&nbsp;</td>
<td width="659">&nbsp;</td>
<td width="50">&nbsp;</td>
<td width="39">&nbsp;</td>
<td width="149">&nbsp;</td>
<td width="4">&nbsp;</td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>

holyhttp
11-15-2007, 01:13 PM
First of you need to only have one form tag <form ...>....</form> enclosing all the fields in your form. You have one <form> in line 123 closed at line 142 </form>. Then a second <form> on line 145 that closes at 158.

You have a third form opened at line 162 and closed at line 167 .

Furthermore the submit (Submit Enquiry) and reset (Clear Form) buttons as well as the "redirect" hidden field are all outside all the 3 forms.

Solution:
a) Remove the forms 2 and 3 but just taking out the opening <form ....> and their corresponding closing tag </form>.
b) move the closing </form> from line 142 to line 180
c) to make sure your HTML tags are well nested you should also move the opening <form ...> tag from line 123 to line 114. That way the form fields layout table can be nested inside the form.

After you are done, enter some data in any field than hit the reset button "Clear Form".

Have fun!!

basils57
11-15-2007, 02:12 PM
Thanks for that hollyhttp, really appreciate your time.

I will make the adjustments and let you know how we get on.

basils57
11-16-2007, 12:09 PM
holyhttp - I've made some progress!

My original page had multiple forms, and so I've re-hashed it, and the new code is listed below. I'm still wanting to send the info back, and to progress to 'thankyou.html'.
Now I can clear info on the form, and when I submit the info, instead of going to the thank you page, I get :

There are missing fields!
recipient is missing

Form Dump:
redirect: http://www.directsafetysolutions.co.uk/thankyou.html
submit: Submit Enquiry
textfield: BSS
textfield2: DSS
textfield3: barry
textfield4: 83
textfield5: 25004
textfield6: 27
textfield7: TF5
textfield8: Hello


The new code is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt" codeOutsideHTMLIsLocked="false" -->
<!-- DW6 -->
<head>
<!-- Copyright 2005 Macromedia, Inc. All rights reserved. -->
<!-- InstanceBeginEditable name="doctitle" -->
<title>Health &amp; Safety Support from Direct Safety Solutions Ltd</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="mm_health_nutr.css" type="text/css" />
<script language="JavaScript" type="text/javascript">
//--------------- LOCALIZEABLE GLOBALS ---------------
var d=new Date();
var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December");
//Ensure correct for language. English is "January 1, 2004"
var TODAY = monthname[d.getMonth()] + " " + d.getDate() + ", " + d.getFullYear();
//--------------- END LOCALIZEABLE ---------------
</script>
<style type="text/css">
<!--
.style2 {color: #993330}
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="dss.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#F4FFE4">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<tr bgcolor="#D5EDB3">
<td colspan="3" rowspan="2" valign="middle" bgcolor="#D5EDB3"><img src="images/baselogo110acv5.png" alt="header" width="874" height="114" /></td>
<td colspan="3" rowspan="2" align="center" valign="bottom" nowrap="nowrap" bgcolor="#d5edb3" id="logo"><p>&nbsp;</p>
<p class="pageName style2">&nbsp;</p></td>
<td width="4" height="50">&nbsp;</td>
</tr>

<tr bgcolor="#D5EDB3">
<td width="4" height="51">&nbsp;</td>
</tr>

<tr>
<td colspan="7" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>

<tr>
<td colspan="7" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
</tr>

<tr bgcolor="#99CC66">
<td colspan="7" id="dateformat" height="20">&nbsp;&nbsp;<script language="JavaScript" type="text/javascript">
document.write(TODAY); </script> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#99CC66" background="mm_dashed_line.gif"><img src="mm_dashed_line.gif" alt="line decor" width="4" height="3" border="0" /></td>
</tr>

<tr>
<td colspan="7" bgcolor="#5C743D"><img src="mm_spacer.gif" alt="" width="1" height="2" border="0" /></td>
</tr>

<tr>
<td width="165" valign="top" bgcolor="#5C743D">
<table border="0" cellspacing="0" cellpadding="0" width="165" id="navigation">
<tr>
<td width="165">&nbsp;<br />
&nbsp;<br /></td>
</tr>
<tr>
<td width="165"><a href="index.html" class="navText">home</a></td>
</tr>
<tr>
<td width="165"><a href="benefits.html" class="navText">how we can benefit your business</a></td>
</tr>
<tr>
<td width="165"><a href="action.html" class="navText">how we achieve results</a></td>
</tr>
<tr>
<td width="165"><a href="consultants.html" class="navText">our consultants </a></td>
</tr>
<tr>
<td width="165"><a href="samples.html" class="navText">sample documents </a></td>
</tr>
<tr>
<td width="165"><a href="subscribe.html" class="navText">subscribe </a></td>
</tr>
<td width="165"><a href="javascript:;" class="navText">members area </a></td>
</tr>
<td width="165"><a href="contact2.html" class="navText">contact us </a></td>
</tr>
</table>
<br />
&nbsp;
<table width="140" border="0" align="center" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td rowspan="3"><img src="images/110_sfs10.gif" alt="Safety Starts Here Sign" width="110" height="164" /></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div align="center"><br />
&nbsp;<br />
&nbsp;<br />
</div></td>
<td width="50"><img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /></td>
<td colspan="4" valign="top"><!-- InstanceBeginEditable name="body" --><img src="mm_spacer.gif" alt="" width="405" height="1" border="0" /><br />
&nbsp;<br />
&nbsp;<br />
<form id="form1" name="form1" method="post" action="http://www.directsafetysolutions.co.uk/cgi-sys/formmail.pl">
<table border="0" cellspacing="0" cellpadding="0" width="673">
<tr>
<td colspan="2" class="pageName">&nbsp;</td>
<td class="pageName">&nbsp;</td>
<td class="pageName">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="pageName"><p>CONTACT US </p></td>
<td width="216" class="pageName">&nbsp;</td>
<td width="264" class="pageName">&nbsp;</td>
</tr>
<tr>
<td colspan="4" class="bodyText"><p> Contact us using the form below, including any questions or comments that you may have. <br />
<br />
Please fill in all applicable details and click the 'Send Enquiry' button to send your request/enquiry to us. </p></td>
</tr>
<tr>
<td colspan="2" class="bodyText">Name*</td>
<td colspan="2" class="bodyText"><label for="company">Company*</label></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><input name="textfield" type="text" tabindex="11" size="30" /></td>
<td colspan="2" class="bodyText"><input name="textfield2" type="text" tabindex="21" size="30" /></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><br />
Email*</td>
<td colspan="2" class="bodyText"><br />
Address</td>
</tr>
<tr>
<td colspan="2" class="bodyText"><input name="textfield3" type="text" tabindex="31" size="30" /></td>
<td colspan="2" rowspan="3" class="bodyText"><textarea name="textfield4" cols="30" rows="5" tabindex="41"></textarea></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><br />
Telephone*</td>
</tr>
<tr>
<td colspan="2" class="bodyText"><input name="textfield5" type="text" tabindex="51" /></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><p><br />
No. of Employees*</p> </td>
<td colspan="2" class="bodyText"><label for="label4"><br />
Postcode</label></td>
</tr>
<tr>
<td colspan="2" class="bodyText"><input name="textfield6" type="text" tabindex="61" size="15" /></td>
<td colspan="2" class="bodyText"><input name="textfield7" type="text" tabindex="71" size="15" maxlength="8" /></td>
</tr>
<tr>
<td colspan="3" class="bodyText"><label for="label6"><br />
Any additional enquiries or comments</label></td>
<td class="bodyText">&nbsp;</td>
</tr>
<tr>
<td colspan="3" class="bodyText"><textarea name="textfield8" cols="60" rows="8" tabindex="81"></textarea></td>
<td class="bodyText">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="bodyText"><br />
<input name="Submit" type="submit" class="bodyTextStrong" value="Submit Enquiry" />
<input name="Clear" type="reset" class="bodyTextStrong" id="Clear" value="Clear Form" />
<br />
<br /></td>
<td class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
</tr>
<tr>
<td height="27" colspan="3" class="bodyText"><span class="bodyTextStrong"><br />
* = Mandatory fields that need to be filled in</span></td>
<td class="bodyText">&nbsp;</td>
</tr>
<tr>
<td width="162" class="bodyText">&nbsp;</td>
<td width="31" class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
</tr>
<tr>
<td class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
<td class="bodyText">&nbsp;</td>
</tr>
</table>
<input type="hidden" name="redirect" value="http://www.directsafetysolutions.co.uk/thankyou.html">
</form>
<div align="center"><span class="smallText">Total Contents copyright &copy; 2007 Direct Safety Solutions Ltd <br />
&nbsp;</span><br />
</div>
<img src="mm_spacer.gif" alt="" width="50" height="1" border="0" /><br />
&nbsp;<br />
<!-- InstanceEndEditable --></td>
<td width="4">&nbsp;</td>
</tr>
<tr>
<td width="165">&nbsp;</td>
<td width="50">&nbsp;</td>
<td width="659">&nbsp;</td>
<td width="50">&nbsp;</td>
<td width="39">&nbsp;</td>
<td width="149">&nbsp;</td>
<td width="4">&nbsp;</td>
</tr>
</table>
</body>
<!-- InstanceEnd --></html>


Any further suggestions would be much appreciated.

basils57
11-16-2007, 12:11 PM
Some additional info - my host co. set up a test page to show that all worked OK - which it does (apart from forwarding the info), but in my ignorance, I am unable to reconcile the information:

<form action="http://www.directsafetysolutions.co.uk/cgi-sys/formmail.pl" method="post">
<input type="hidden" name="recipient" value="test@directsafetysolutions.co.uk">
<input type="hidden" name="subject" value="Subjectline">
Your email address:<input type="text" name="email" size="20" value=""><br />
What do you want to say?:<input type="text" name="content" size="20" value=""><br /><br />
<input type="submit" name="submit" value="E-Mail Me!">
<input type="hidden" name="redirect" value="http://www.directsafetysolutions.co.uk/thankyou.html">
</form>

The redirect for the sent info should be directed to 'info@directsafetysolutions.co.uk'

holyhttp
11-16-2007, 12:33 PM
The required fields are "recipient", "subject", "email", "content" and "redirect".

You need to have those fields in your form with the same names (lowercase letters).
Therefore for instance your textarea:
<textarea name="textfield4" cols="30" rows="5" tabindex="41"></textarea>

should be rewritten: <textarea name="content" cols="30" rows="5" tabindex="41"></textarea>
as you notice I chnage the name to match what your web hosting provider suggested.

You need to cleanup your form and give your fields proper name i.e.
textfield, textfield2, textfield3 need to be change to more appropriate meaningful names.

basils57
11-17-2007, 06:19 AM
Hi again holyhttp

At last I've got it and it works!
Thanks for persevering with this novice, I now know a 'little' bit more.