Jump to content

PHP email question


TruSake

Recommended Posts

Hi,

I got an email contact form page on my website, with the following php code:

 

 

 

<?php
$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$formcontent=" From: $name \n Message: $message";
$recipient = "[email protected]";
$subject = "Web Mail";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
$url = 'www.somesite.com';
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>
 

 

 

Now, it works just fine when sending, but my situation is that apparently people can just press the Send button even if they don't fill everything out.

Can anyone tell me what the code would be to have all fields required to be filled?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/275838-php-email-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.