Z
Zoid in Code
Enthusiast
Hey so when ive filled in all info on my form it says fields required. How can I fix it?
PHP:
<?php
if(isset($_POST["submit"])){
//Checking for blank Fields..
if ($_POST["email"]==""||$_POST["message"]==""){
echo "Fill All Fields..";
}else{
// Check if the "Sender's Email" input field is filled out
$email=$_POST['email'];
// Sanitize e-mail address
$email =filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate e-mail address
$email= filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email){
echo "Invalid Sender's Email";
}
else{
$subject = $_POST['Unity Code | Contact Form'];
$message = $_POST['msg'];
$headers = 'From:'. $email2 . "\r\n"; // Sender's Email
$headers .= 'Cc:'. $email2 . "\r\n"; // Carbon copy to Sender
// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
// Send mail by PHP Mail Function
mail("[email protected]", $subject, $message, $headers);
echo "Your mail has been sent successfuly! We will contact you soon";
}
}
}
?>
HTML:
<div class="footer-right">
<p>Contact Us</p>
<form id="form" action="#" method="post">
<input type = "text" name="vname" value="" placeholder="Your Name"/>
<input type = "text" name="vemail" value="" placeholder="Your Email"/>
<input type = "text" name="sub" value="" placeholder="Subject"/>
<label>Your Suggestion/Feedback</label>
<textarea name="msg" placeholder="Type your text here..."></textarea>
<input type="submit" name="submit" id="send" value="Send Feedback"/>
</form>
<h3><?php include "secure_email_code.php" ?></h3>
</div>
PHP:
<?php
if(isset($_POST["submit"])){
//Checking for blank Fields..
if ($_POST["email"]==""||$_POST["message"]==""){
echo "Fill All Fields..";
}else{
// Check if the "Sender's Email" input field is filled out
$email=$_POST['email'];
// Sanitize e-mail address
$email =filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate e-mail address
$email= filter_var($email, FILTER_VALIDATE_EMAIL);
if (!$email){
echo "Invalid Sender's Email";
}
else{
$subject = $_POST['Unity Code | Contact Form'];
$message = $_POST['msg'];
$headers = 'From:'. $email2 . "\r\n"; // Sender's Email
$headers .= 'Cc:'. $email2 . "\r\n"; // Carbon copy to Sender
// message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
// Send mail by PHP Mail Function
mail("[email protected]", $subject, $message, $headers);
echo "Your mail has been sent successfuly! We will contact you soon";
}
}
}
?>
HTML:
<div class="footer-right">
<p>Contact Us</p>
<form id="form" action="#" method="post">
<input type = "text" name="vname" value="" placeholder="Your Name"/>
<input type = "text" name="vemail" value="" placeholder="Your Email"/>
<input type = "text" name="sub" value="" placeholder="Subject"/>
<label>Your Suggestion/Feedback</label>
<textarea name="msg" placeholder="Type your text here..."></textarea>
<input type="submit" name="submit" id="send" value="Send Feedback"/>
</form>
<h3><?php include "secure_email_code.php" ?></h3>
</div>