Jump to content

ugreen

New Members
  • Posts

    6
  • Joined

  • Last visited

ugreen's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you both! I will have to play around with both of these and see what I can get working!
  2. Thanks for your help. I've been trying to use 'include' and other options, but none have worked so far. I might have to skip the validation.
  3. That works great, except how do I display that error in the same page (maybe a separate span)?
  4. What happens is, the message gets displayed in a new window and the form gets sent anyway. I guess I just want to validate that there is something in the name and emails fields and email only be sent IF there is something in those fields.
  5. Yes. That's really all I need. Sorry, now where do I incorporate this? Also, can I choose where the error will be displayed?
  6. Hi all, I have a contact form that works fine, I just need some REALLY BASIC validation added. As long as someone types in ANYTHING into the Name and Email fields to send the form. I would really appreciate some really simple validation that would work with what I have. I honestly have no idea how I got this far. THANKS IN ADVANCE! Here is the form code: -------------- <form method="post" action="sendmailscript.php"> <fieldset> <legend>Contact Information:</legend> <div> <label>Name*</label> <input name="name" type="text" required="required"/> <br /> </div> <div> <label>Company Name</label> <input name="company" type="text"/> <br /> </div> <div> <label>Phone Number</label> <input name="phone" type="tel" /> <br /> </div> <div> <label>Email Address*</label> <input name="email" type="email" required="required" /> <br /> </div> <div> <label>Website Address</label> <input name="website" type="url" /> <br /> </div> </fieldset> <fieldset> <legend>Preferred Meeting Type:</legend> <div> <label> </label> <input type="radio" name="meeting" value="Go To Meeting" /> <span class="checkboxDesc">Set Up A Go To Meeting Online Demo</span><br /> <label> </label> <input type="radio" name="meeting" value="Face To Face" /> <span class="checkboxDesc">Contact Me About A Face-To-Face Meeting</span><br /> <label> </label> <input type="radio" name="meeting" value="Would Like More Information" /> <span class="checkboxDesc">More Information</span><br /> </div> </fieldset> <fieldset> <legend>I'm Interested In:</legend> <div> <label>Request Information On:</label> <input type="checkbox" name="services[]" value="Call Tracking Telephone Numbers" /> <span class="checkboxDesc">Call Tracking Telephone Numbers</span><br /> <input type="checkbox" name="services[]" value="Design, Print & Mail Direct Mail Packages" /> <span class="checkboxDesc">Design, Print & Mail Packages</span><br /> <input type="checkbox" name="services[]" value="Direct Mail List Purchase" /> <span class="checkboxDesc">Direct Mail List Purchase</span><br /> <input type="checkbox" name="services[]" value="Printing & Graphic Design Services" /> <span class="checkboxDesc">Printing & Graphic Design Services</span><br /> <input type="checkbox" name="services[]" value="Website Design Services" /> <span class="checkboxDesc">Website Design Services</span><br /> <input type="checkbox" name="services[]" value="QR Codes & Landing Pages" /> <span class="checkboxDesc">QR Codes & Landing Pages</span><br /> <input type="checkbox" name="services[]" value="Mobile Websites" /> <span class="checkboxDesc">Mobile Websites</span><br /> <input type="checkbox" name="services[]" value="Sales & Lead Tracking Software" /> <span class="checkboxDesc">Sales & Lead Tracking Software</span><br /> <input type="checkbox" name="services[]" value="Marketing & Sales Consulting Services" /> <span class="checkboxDesc">Marketing & Sales Consulting Services</span><br /> </div> <div> <label>Message</label> <textarea name="message" id="message" rows="5" required="required" /> </textarea> </div> </fieldset> <input type="submit" name="submit" value="Submit" class="button" /> </form> ______________ Here is the php code: ----------- <?php $EmailTo = "me@me.com"; $Subject = "Request Form"; $Name = Trim(stripslashes($_POST['name'])); $Company = Trim(stripslashes($_POST['company'])); $Tel = Trim(stripslashes($_POST['phone'])); $Email = Trim(stripslashes($_POST['email'])); $Website = Trim(stripslashes($_POST['website'])); $Meeting = $_POST['meeting']; $Services = Implode("\n", $_POST['services']); $Message = Trim(stripslashes($_POST['message'])); $mailheader .= "Reply-To: $Email \r\n"; // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Company: "; $Body .= $Company; $Body .= "\n"; $Body .= "Phone: "; $Body .= $Tel; $Body .= "\n"; $Body .= "Email: "; $Body .= "$Email"; $Body .= "\n"; $Body .= "Website: "; $Body .= $Website; $Body .= "\n\n"; $Body .= "Preferred Meeting Type: \n"; $Body .= $Meeting; $Body .= "\n\n"; $Body .= "I'm Interested In: \n"; $Body .= $Services; $Body .= "\n\n"; $Body .= "Message: \n"; $Body .= $Message; // send email $success = mail($EmailTo, $Subject, $Body, "From: <$Email>"); // redirect to success page if ($success){ print "<meta http-equiv=\"refresh\" content=\"0;URL=thanks.html\">"; } else{ print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">"; } ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.