Jump to content
sonu

PHP Form

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!

Share this post


Link to post
Share on other sites

Well, somewhere you need to have <input type="checkbox"> and make check if it is clicked..

Share this post


Link to post
Share on other sites

well, what have you tried? What isn't working? You present some code with your attempts first.

Share this post


Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...

×
×
  • Create New...