Member Offer
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Php mail forms

Discussion in 'Website Design Forum:' started by mrp2049, Jun 15, 2011.

  1. mrp2049

    mrp2049 Senior Member

    I know there have been a few threads about this already, but I have tried to piece one together for work and I've got to this point:

    Claimcom: Communicazione Integrata

    And I can not for the life of me figure out what the hell I am doing wrong! Any bright ideas?
     
  2. Kevin

    Kevin Senior Member

    Can't help you out without seeing the actual php.

    Your HTML form could be a little more semantic though.
    HTML:
    <form action="contact.php" method="post"> 
      <div><label for="cf_name">Your name</label> 
      <input type="text" name="cf_name" if="cf_name" /></div>
    
      <div><label for="cf_email">Your e-mail<label>
      <input type="text" name="cf_email" id="cf_email" /></div>
    	
      <div><label for="cf_phone">Your phone number</label>
      <input type="text" name="cf_phone" id="cf_phone" /></div>
    
      <div><label for="cf_message">Message</label> 
      <textarea name="cf_message" id="cf_message" cols="50" rows="20"></textarea></div>
    
      <div><input type="submit" value="Send"></div>
    </form>
    Along with some css to fix all the removed <br /> tags.
    Code:
    form div, label {   display:block; }
    Edit: Arguably you could replace those divs by paragraphs, or breaklines like you had, for disabled css. You should add those labels (and id's) though.
     
  3. mrp2049

    mrp2049 Senior Member

    Code:
    <?php$field_name = $_POST['cf_name'];$field_email = $_POST['cf_email'];$field_message = $_POST['cf_message'];$field_phone = $_POST['cf_phone'];$mail_to = 'mrp2049@htomail.com';$subject = 'Message from a site visitor '.$field_name;$body_message = 'From: '.$field_name."\n";$body_message .= 'E-mail: '.$field_email."\n";$body_message . 'Phone: '.$field_phone."\n";$body_message .= 'Message: '.$field_message;$headers = 'From: '.$cf_email."\r\n";$headers .= 'Reply-To: '.$cf_email."\r\n";$mail_status = mail($mail_to, $subject, $phone, $body_message, $headers);if ($mail_status) { ?>	<script language="javascript" type="text/javascript">		alert('Thank you for the message. We will contact you shortly.');		window.location = 'contacteng.html';	</script><?php}else { ?>	<script language="javascript" type="text/javascript">		alert('Message failed. Please, send an email to fontani@claimcom.it');		window.location = 'contacteng.html';	</script><?php}?>
     
  4. Kevin

    Kevin Senior Member

    Do you get an error? Because if you don't, you're just not getting the email because of this:
     
  5. mrp2049

    mrp2049 Senior Member

    I am a tool!

    See a fresh pair of eyes makes all the difference!
     
  6. Kevin

    Kevin Senior Member

    Also in your mail function I'm not sure if that $phone is legit, but I may be wrong. It's not necessary though, right? It's shown in the $body_message anyway.

     
  7. mrp2049

    mrp2049 Senior Member

    It's still not working.

    I'll delete the phone bit and see what happens.
     
  8. mrp2049

    mrp2049 Senior Member

    It said it would sent...
     
  9. mrp2049

    mrp2049 Senior Member

    How long should it take to arrive?
     
  10. aibrean

    aibrean Member

    Is your whole site (root domain) supposed to be down?
     
  11. Kevin

    Kevin Senior Member

    No longer than a few seconds. Minutes at the very worst.

    I did spot a missing = sign along the way
     
  12. mrp2049

    mrp2049 Senior Member

    Scratch that, it works now!
     
  13. mrp2049

    mrp2049 Senior Member

    I deleted all the phone parts.
     
  14. mrp2049

    mrp2049 Senior Member

    Apparently I have the wrong index file on my server!

    :clap:

    for being a tool!
     
  15. aibrean

    aibrean Member

    Unless you have GoDaddy hosting. I've had clients where it took 30 minutes to get it through them.
     
  16. Jazajay

    Jazajay Active Member

    I had a 12 hour delay the other day 4 seperate times. But glad you got it sorted, didn't think the variable $phone in the mail function was err...exactly correct. :)
     

Share This Page