Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29767

How do I receivie contact information form site visitors to my email address? [duplicate]

$
0
0

I'm attempting to create some php forms that complement the contact form on my website. I believe I have the one to verify a user's contact information down pat-excepting how to get the message out that the data is invalid or that the message has been sent.

I am hoping to have the users information - name, email address, email subject, and message - sent to my email address, and in turn make sure they get the message that the message was sent.

PHP

<?php
function contact()
{
 $empty = array();
 $missing = array();
 $required = array('post_name','post_email','post_crazy_form');
 $required_values = array('post_name','post_email','post_crazy_form');
 foreach ($required as $k1) {if (!isset($_POST[$k1])) {array_push($missing,$k1);}}
 foreach ($required_values as $k2) {if (isset($_POST[$k2]) && strlen($_POST[$k2]) == 0) {array_push($empty,$k2);}}

 if (count($missing) > 0) {$i = 0; $text = ''; foreach ($missing as $k2) {$text .= $k2.', '; $i++;} $text = substr($text,0,strlen($text) - 2); if (count($missing)>1) {$text .= ' were';} else {$text .= ' was';} http_report(400,__FUNCTION__,'Error: permission denied; expected variable(s) '.$text.' was not defined so the request can not be processed.');}
 else if (count($empty) > 0) {$i = 0; $text = ''; foreach ($empty as $k2) {$text .= $k2.', '; $i++;} $text = substr($text,0,strlen($text) - 2); if (count($empty)>1) {$text .= ' were';} else {$text .= ' was';} http_report(400,__FUNCTION__,'Error: permission denied; the variable(s) '.$text.' empty so the request can not be processed.');}
 else
 {
  print_r($_POST);
  //What now?
 }
}
?>

HTML

<form action="contact/" method="post">
<fieldset>
<div><input name="post_name" type="text" /></div>
<div><input name="post_email" type="text" /></div>
<div><input name="post_crazy_form" type="text" /></div>
<div><input name="post_contact" type="submit" value="Submit this Form" /></div>
</fieldset>
</form>

Viewing all articles
Browse latest Browse all 29767

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>