What's new

Web PHP script problems

  • Thread starter Zoid in Code
  • Start date
  • Views 447
Status
Not open for further replies.
Z

Zoid in Code

Enthusiast
Messages
447
Reaction score
49
Points
85
Sin$
0
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>
 
Z61

Z61

Some times our saints are sinners
Retired
Programmer Forum Addict Odysseus' Summit
Messages
5,468
Reaction score
3,429
Points
1,042
Sin$
0
Learn how to use the language(s) then come back and try this. You are running into problems at literally every step.
 
Z

Zoid in Code

Enthusiast
Messages
447
Reaction score
49
Points
85
Sin$
0
I thourght this was the debugging section oh well ...
 
Status
Not open for further replies.
Top Bottom
Login
Register