I've created a form which works fine, but when I put it in a table it always thinks the form is incomplete - is there a way I can put it in a table (so it looks nice!) without this problem?
-----My HTML------
<h2 class="green">Interested in making life easier?</h2>
<form method="post" action="sendemail.php">
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Name:
<input type="text" name="visitor" size="25" />
<br />
Address:<input type="text" name="visitoradd" size="25" />
<br />
City:<input type="text" name="visitorcity" size="15" />
<br />
Postcode:<input type="text" name="visitorpost" size="15" />
<br />
Email:<input type="text" name="visitormail" size="25" />
<br />
Telephone Number:<input type="text" name="visitortel" size="25" />
<br />
Bookkeeping/Payroll:<select name="bp" size="1">
<option value=" Bookkeeping">Bookkeeping </option>
<option value=" Payroll ">Payroll</option>
</select>
<br />
Number of transactions: <input type="text" name="transcations" size="15" />
<br />
Number of employees:<input type="text" name="employees" size="15" />
<br />
Payroll weekly/monthly:<select name="pmw" size="1">
<option value=" Weekly">Weekly</option>
<option value=" Monthly">Monthly</option>
</select>
<br />
<br />
<INPUT TYPE="image" SRC="images/btnSubmit.png" ALT="Submit Form">
<br />
</form>
-----My PHP-----
<?php
$visitor = $_POST['visitor'];
$visitoradd = $_POST['visitoradd'];
$visitorcity= $_POST['visitorcity'];
$visitorpost= $_POST['visitorpost'];
$visitormail = $_POST['visitormail'];
$visitortel = $_POST['visitortel'];
$bp = $_POST['bp'];
$transcations = $_POST['transcations'];
$employees = $_POST['employees'];
$pmw = $_POST['pmw'];
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Please enter valid e-mail.</h2>\n";
$badinput = "<h2>Click the back button to retry.</h2>\n";
echo $badinput;
die ("Thank you.");
}
if(empty($visitor) || empty($visitormail) || empty($visitorcity) || empty($visitorpost) || empty($visitoradd) || empty($visitortel) || empty($bp) || empty($transcations) || empty($employees) || empty($pmw) || empty($pmw))
{
echo "<h2>Please fill in all fields, click the back button to retry</h2>\n";
die ("Thank you.");
}
$message = "
Name: $visitor\n
Address: $visitoradd\n
City: $visitorcity\n
Post Code: $visitorpost\n
Email: $visitormail\n
Phone Number: $visitortel\n
Bookkeeping/Payroll: $bp\n
Number of Transactions: $transcations\n
Number Of Employees: $employees\n
Payroll Weekly/Monthly: $pmw\n"
;
$subject = "Payment Details";
mail("contact@email.com",$subject,$message,$visitormail);
?>
<p align="center">
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />
<br />
<a href="home.php">Click here to Finish</a>
</p>
Place the form tags outside of the table like so:
If you are needing to specify width, height, etc.. then use CSS.
Here is a great tutorial on it: http://www.w3schools.com/css/