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 = "elvis@presley.com";
$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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