How to create a feedback form in my website?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Binod Rai

    How to create a feedback form in my website?

    Code:
    <?php
    	$yourname = $_REQUEST['yourname'];
    	$youremail = $_REQUEST['email'];
    	$yourorg = $_REQUEST['yourorg'];
    	$yourcomment = $_REQUEST['yourcomment'];
    	$submit = $_REQUEST['submit'];
    	
    	if(isset($submit)) 
    	{
    		if($yourname ==""){
    		$error = "Please fill in your name.."; }
    		elseif($youremail =""){
    		$error = "Invalid email address"; }
    		elseif($yourcomment == ""){
    		$error = "Please fill in your comment"; }
    	}
    	else
    	{
    			mail("binodranarai@yahoo.com","$yourname<$youremail>",$yourcomment);
    			print "<link href='feedback.php'>";
    	}
    ?>
    I get the following Error. How can I overcome the following error? Please help me.

    Warning: mail() [function.mail]: "sendmail_f rom" not set in php.ini or custom "From:" header missing in C:\xampp\htdocs \feedbackfrm.ph p on line 19
    Last edited by Dormilich; Nov 10 '10, 09:05 AM. Reason: please use [CODE] [/CODE] tags when posting code
  • Cmaza
    New Member
    • May 2007
    • 16

    #2
    Your PHP installation (most likely) doesn't have a default sendmail_from (originating email address) specified in its configuration and no originating email address has been specified in the headers of your call to mail (function).

    Also, if the "$yourname<$you remail>" part of your call is the intended originating email address, then the syntax of your call isn't entirely accurate, as the second (2nd) variable of a mail call should be the subject.

    The correct syntax for mail is ( string $to , string $subject , string $message [, string $additional_hea ders [, string $additional_par ameters ]] ).

    Instead of:

    mail("binodrana rai@yahoo.com", "$yourname<$you remail>",$yourc omment);

    Try:

    mail("binodrana rai@yahoo.com", $subject,$yourc omment,"From: ".$yourname ." <".$youremail." >");

    (Where $subject represents the intended subject header of the email to be sent).

    To give you an idea, for comparative purposes, this is what the call to mail() looks like as it is in the email management component of my CMS:

    mail($msgto,"[".global_sitena me."] ".$msgsubject,$ content,"MIME-Version: 1.0\r\nContent-type: text/plain; charset=iso-8859-1\r\nFrom: ".global_mail_b lackhole);

    I hope this helps. :)

    Comment

    Working...