Jump to content

PHP Form


sonu

Recommended Posts

Hello Guys,I am creating one simple php form all works great but I want solution for one thing.I want cc optional like I have checkbox in the form & if user click it then only it should send CC mail other wise not.Here is the code which I am using.

<?php ob_start();$fromemail="No-Reply <demo@demo.com>"; // change here if you want$toemail="demo@demo.com";   // change here if you want$sub="Online Feedback";		  // change here if you want$success_page_name="index.php";////// do not change in followingif($_SERVER['REQUEST_METHOD']=="POST"){$fieldnm_1=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_1']));$fieldnm_2=str_replace ( array("\n"), array("<br>"),trim($_REQUEST['fieldnm_2'])); $contentmsg=stripslashes("<br><b><font style=color:#CC3300>$sub</font></b><br><table width=708 border=0 cellpadding=2 cellspacing=1 bgcolor=#CCCCCC><tr>	  <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Name :</b> </td>	  <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_1</td></tr><tr>	  <td width=165 align=right valign=top bgcolor=#FFFFFF><B>Email :</b> </td>	  <td width=565 align=left valign=top bgcolor=#FFFFFF>$fieldnm_2</td></tr></table>");////$headers  = "MIME-Version: 1.0";$headers .= "Content-type: text/html; charset=iso-8859-1";			  $from=$fromemail;			  $headers .= "From: ".$from."";$headers.= "Cc: ".$fieldnm_2."";			  @mail($toemail,$sub,$contentmsg,$headers);			  			  header("Location:$success_page_name");}?>

Thanks in Advance!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...