Results 1 to 3 of 3

Thread: Please help me with this Email Form

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2006
    Posts
    29

    Resolved Please help me with this Email Form

    I have a Form from where user Will put the Name, Message and his mail Id. And The details will be mailed to specified Mail BOX. Now I Need to put a image instead of a Submit Button. If i put the Submit Button the Mail Easily Delivered to me. If i put the Image then its not delivering.. please help me what to do??

    Code:
    <?php
     $error = "";
     $success = FALSE;
    if(isset($_POST['submit']))
    {
      foreach($_POST as $key => $val)
      {
        if(empty($_POST[$key]))
        {
          $error .= "You must enter a value for " .
                    ucwords(str_replace("_"," ",$key)) . ". ";
        }
        else
        {
          if(get_magic_quotes_gpc())
          {
            $_POST[$key] = stripslashes($val);
          }
        }
        if($key != 'enquiry')
        {
          $_POST[$key] = preg_replace('/[\r\n]/', ' ', $val);
        }
      }
       if($_POST['email'] == 0)
      {
        //$error .= "'{$_POST['email']}' does not appear to be a valid email address. ";
      }
    
        $to = "xxx@***.com"; 
    	$headers  = "MIME-Version: 1.0\r\n"; 
    	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; 
    	$headers .= "From: ".$_POST['email']."\r\n"; 
    	$mail =  @mail($to,$_POST['name'],$_POST['enquiry'],$headers); 
    	if(!$mail)
        {
          $error .= "There was an unknown error occurred ";
        }
        else
        {
          $error .= "Your message has been successfully sent. ";
        }
    }
    
    ?>
    
    <form name="ContactUs" method="post" action="../index.php?main_page=contact_us&action=success">
    <table  width="100%" border="0" cellspacing="2" cellpadding="2" >
      <tr>
        <td class="plainBoxHeading" colspan="2">NAME</td>
      </tr>
      <tr>
        <td class="main" colspan="2"><input name="name" type="text"></td>
      </tr>
      <tr>
        <td class="plainBoxHeading" colspan="2">EMAIL</td>
      </tr>
      <tr>
        <td class="main" colspan="2"><input name="email" type="text" size="50"></td>
      </tr>
      <tr>
        <td class="plainBoxHeading" colspan="2">Message</td>
      </tr>
      <tr>
        <td class="main" colspan="2"><textarea name="enquiry" cols="50" rows="15"></textarea></td>
      </tr>
      <tr>
        <td align="right" class="main"><a href =" javascript : submitForm(); "><img src="../includes/templates/template_default/buttons/english/button_send.gif" alt="send now"></a></td>
      </tr>
    </table>
    </form>
    
    
    <script language = "javascript">
    function submitForm() {
    document.ContactUs.submit();
    }
    </script>
    Last edited by mishu007; Apr 26th, 2007 at 01:16 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width