Psionicsin
07-25-2011, 06:26 PM
Downloaded a great contact form with location map (can't remember where from), however when I try to validate the page I'm getting back a lot of errors and need help cleaning them up if anyone would be so kind.
Many of the errors I have cleaned up, and the rest MIGHT be minor, however I didn't want to take a chance with breaking anything without asking people more knowledgeable than myself.
The majority of the errors are "The for attribute of the label element must refer to a form control."
The form, as it stands currently, has the for attributes as follows...
[located on http://www.rutholsonphoto.com/contact.php]
<form id="contact" method="post" action="">
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name" title="Enter your name" class="required">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="yourname@domain.com" title="Enter your e-mail address" class="required email">
<label for="phone">Phone</label>
<input type="tel" name="phone" placeholder="ex. (555) 555-5555">
<label for="website">Website</label>
<input type="url" name="url" placeholder="http://">
<label for="message">Question/Comment</label>
<textarea name="message"></textarea>
<input type="submit" name="submit" class="button" id="submit" value="Send Message" />
</fieldset>
</form>
Now I COULD possibly go in and change these to more HTMl correct names, but I want to make sure it's not going to interfere with our processing code which is...
<?php
// Get Data
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$url = strip_tags($_POST['url']);
$message = strip_tags($_POST['message']);
// who is getting this email ...
$to="email@email.com";
// subject
$subject="Website Mail";
$msg = "
Website Mail
---------------------------------------------------
Name: $name
Phone: $phone
Email: $email
URL: $url
---------------------------------------------------
$message
---------------------------------------------------
";
$extraheaders = "From: $email\r\nReply-To: $email\r\n";
if (! mail($to, $subject, $msg, $extraheaders))
echo "Mail did not send for some reason.";
// where to go after the email is sent ...
header("Location: ./index.php");
?>
Do you guys think the processing form is using the *or or the *name attribute for it's feeding values???
Many of the errors I have cleaned up, and the rest MIGHT be minor, however I didn't want to take a chance with breaking anything without asking people more knowledgeable than myself.
The majority of the errors are "The for attribute of the label element must refer to a form control."
The form, as it stands currently, has the for attributes as follows...
[located on http://www.rutholsonphoto.com/contact.php]
<form id="contact" method="post" action="">
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" placeholder="Full Name" title="Enter your name" class="required">
<label for="email">E-mail</label>
<input type="email" name="email" placeholder="yourname@domain.com" title="Enter your e-mail address" class="required email">
<label for="phone">Phone</label>
<input type="tel" name="phone" placeholder="ex. (555) 555-5555">
<label for="website">Website</label>
<input type="url" name="url" placeholder="http://">
<label for="message">Question/Comment</label>
<textarea name="message"></textarea>
<input type="submit" name="submit" class="button" id="submit" value="Send Message" />
</fieldset>
</form>
Now I COULD possibly go in and change these to more HTMl correct names, but I want to make sure it's not going to interfere with our processing code which is...
<?php
// Get Data
$name = strip_tags($_POST['name']);
$email = strip_tags($_POST['email']);
$phone = strip_tags($_POST['phone']);
$url = strip_tags($_POST['url']);
$message = strip_tags($_POST['message']);
// who is getting this email ...
$to="email@email.com";
// subject
$subject="Website Mail";
$msg = "
Website Mail
---------------------------------------------------
Name: $name
Phone: $phone
Email: $email
URL: $url
---------------------------------------------------
$message
---------------------------------------------------
";
$extraheaders = "From: $email\r\nReply-To: $email\r\n";
if (! mail($to, $subject, $msg, $extraheaders))
echo "Mail did not send for some reason.";
// where to go after the email is sent ...
header("Location: ./index.php");
?>
Do you guys think the processing form is using the *or or the *name attribute for it's feeding values???