Jump to content

duplication in my form


divinedesigns1
 Share

Recommended Posts

hello, i keep having duplication on my form when i get the email it be like yawn yawn etc code is below

<?php@$fn = $_POST['firstname'];@$ln = $_POST['lastname'];@$email = $_POST['email'];@$come = $_POST['company'];@$sub = $_POST['Subject'];@$enq = $_POST['enqment'];if(isset($_POST['submit'])){if(empty($fn) && empty($ln) && empty($come) && empty($sub) && empty($enq)){  echo 'One or More Fields Are Empty, Please Review & Fill In Those Fields';}elseif(!empty($fn) && empty($ln) && empty($come) && empty($sub) && empty($enq) && empty($email)){  echo 'Last Name </br> Company</br>Subject</br>Enquiry and email is empty, kindly fill these fields to processed';}elseif(!empty($fn) && !empty($ln) && empty($come) && empty($sub) && empty($enq) && empty($email)){  echo 'Company</br>Subject</br>Enquiry and emailis empty, kindly fill these fields to processed';}elseif(!empty($fn) && !empty($ln) && !empty($come) && empty($sub) && empty($enq) && empty($email)){  echo 'Subject, Enquiry and Email is empty, kindly fill these fields to processed';}elseif(!empty($fn) && !empty($ln) && !empty($come) && !empty($sub) && empty($enq) && empty($email)){  echo 'Enquiry and email is empty, kindly fill these fields to processed';}elseif(!empty($fn) && !empty($ln) && !empty($come) && !empty($sub) && !empty($enq) && empty($email)){  echo 'Email is empty, kindly fill these fields to processed!';}elseif(!empty($fn) && !empty($ln) && !empty($come) && !empty($sub) && !empty($enq) && !empty($email)){  $fn = strip_tags($fn) . stripslashes($fn);  $ln = strip_tags($ln) . stripslashes($ln);  $come = strip_tags($come) . stripslashes($come);  $sub = strip_tags($sub) . stripslashes($sub);  $enq = strip_tags($enq) . stripslashes($enq);  if(filter_var($email, FILTER_VALIDATE_EMAIL) == $email){   echo 'This email address is not valid';  }else{}  $to = "dds1@dds1.net";   $subject = $sub;   $message = $enq;   $from = $email;   $headers = "From:" . $email . $fn . $ln;   mail($to, $subject, $message, $headers);   echo "Your Request have been sent!!!";     $fn = "";   $ln = "";   $email = "";   $come = "";   $sub = "";   $enq = "";}else{  echo 'We were unable to send your request! </br> Kindly make sure all fields are fill and try again';}}?><h3 style="margin-top:10px;">Contact Us</div><div id="forms" style="margin:10px auto 0px auto; width:550px;"><form action="" method="post"><div class="formsone" style="width:100%; margin-bottom:10px;"><label id="title" style="overflow:left; width:150px; text-align:right;">First Name: </label><input name="firstname" type="text" size="35" style="margin-left:40px;" value="<?php echo $fn; ?>" /></div><div class="formsone" style="width:100%; margin-bottom:10px;"><label id="title" style="overflow:left; width:150px; text-align:right;">Last Name: </label><input name="lastname" type="text" size="35" style="margin-left:40px;" value="<?php echo $ln; ?>" /></div><div class="formsone" style="width:100%; margin-bottom:10px;"><label id="title" style="oveflow:left; width:150px; text-align:right;">Email: </label><input name="email" type="email" size="35" style="margin-left:70px;" value="<?php echo $email; ?>" /></div><div class="formsone" style="width:100%; margin-bottom:10px;"><label id="title" style="overflow:left; width:150px; text-align:right;">Company: </label><input name="company" type="text" size="35" style="margin-left:48px;" value="<?php echo $come; ?>" /></div><div class="formsone" style="width:100%; margin-bottom:10px;"><label id="title" style="overflow:left; width:150px; text-align:right;">Subject: </label><input name="Subject" type="text" size="35" style="margin-left:60px;" value="<?php echo $come; ?>" /></div><div class="formsone" style="width:100%; margin-bottom:10px;"><div class="formlabel" style="float:left; width:50px; text-align:right;"><label id="title">Enquiry: </label></div><div class="forminput" style="float:right; width:440px;"><textarea name="enqment" cols="50" rows="10"><?php echo $enq; ?></textarea></div></div><div class="formsone" style="width:100%; text-align:left; clear:both;"><input type="submit" name="submit" id="submit" value="Submit" /></div></form></div>

Link to comment
Share on other sites

what do you mean by duplication on form?

Link to comment
Share on other sites

what do you mean by duplication on form?
like when i submit the form i keep on getting duplicates of everything in the email
Link to comment
Share on other sites

strip_tags($sub) . stripslashes($sub);
You are concatenating both of them everytime
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...