www.webdeveloper.com
Results 1 to 3 of 3

Thread: html form within emails, different behaviours

  1. #1
    Join Date
    Dec 2008
    Posts
    64

    html form within emails, different behaviours

    Hi All,


    On my site I have a place where users can upload posts.

    I have php page that sends the user a confirmation email after their post, where the $_POST values populate the a hidden form. The user is only presented with a form submit button, which allows them to remove the post.

    My issue is as follows... I am testing with my own email account. When i recieve the mail with a web based mail client , I see the $_POST values and the form method posts the values to the next page where i process the post removal

    However if i open the received mail with Outlook express, the hidden form values are there( checked by changing input type from hidden to text), but when i click the submit button, the values are not posted and the far end page, it just gets empty $_POST values.

    Hope this is ok to understand.
    Same code acts differently when viewing with different email clients..

    Here is the email sending with the form and the values

    PHP Code:
     

    $to 
    =   $_POST['email'];
    $subject "##";
    //$txt=   $_POST['title'];

    $txt "
    <html>
    <head>
    <title>HTML email</title>
    </head>
    <body>
    <strong>You have listed your item</strong>
     
      <strong>Make:</strong> "
    $_POST['make']. "   <br />
      <strong>Model:</strong> "
    $_POST['model']. "   <br />
      <strong>Category:</strong> "
    $_POST['category']. "   <br />
     <strong>Title:</strong>"
    $_POST['title']."  <br />
    <strong> Description:</strong>"
    $_POST['description']."  <br />
    <strong> Price:</strong>"
    $_POST['price']."  <br />
    <strong> Location:</strong>"
    $_POST['location']. " <br /> <br /> <br />


    <strong> Your Name</strong>"
    $_POST['name']. " <br />
    <strong>  Your Telephone Number:</strong>"
    $_POST['telephone']. " <br />
    <strong> Your Email Address:&nbsp;</strong>"
    $_POST['email']. " <br />
     

     <form  method='post' action='mywebsite_post removal proccesing page.php'>
     <input type='hidden' name='title'    value='"
    $_POST['title']."' />
      <input type='hidden' name='image'   value='"
    $_POST['image']."' />
     <input type='hidden' name='model'     value='"
    $_POST['model']."' />
      <input type='hidden' name='make'     value='"
    $_POST['make']."' />
       <input type='hidden' name='category'     value='"
    $_POST['category']."' />
       <input type='hidden' name='location'     value='"
    $_POST['location']."' />
     <input type='hidden' name='description'    value='"
    $_POST['description']."'/>
      <input type='hidden' name='name'    value='"
    $_POST['name']."'/>
       <input type='hidden' name='telephone'    value='"
    $_POST['telephone']."'/>
        <input type='hidden' name='email'    value='"
    $_POST['email']."'/>
      <input type='hidden' name='price'     value='"
    $_POST['price']."'/>
     <input type='submit' value='Remove Your Post' />
     </form>
     
     
    </body>
    </html>
    "
    ;


    $headers "MIME-Version: 1.0" "\r\n";
    $headers .= "Content-type:text/html;charset=iso-8859-1" "\r\n";

      


    mail($to,$subject,$txt,$headers); 
    .
    Is it to do with the email headers being incomplete or wrong?
    Thanks in advance

    Adrian

  2. #2
    Join Date
    Mar 2010
    Posts
    2,803
    Sending html emails can be problematic because different email client programs support html and css to varying degrees.

    You should try to keep html code for emails as simp,e as possible.

    Imo a must have in html emails is a link to a web version of the email content for those that:

    1) have html email switched off in their email programs

    2) use email programs with poor support for html and css.

    I suspect many email programs won't support the <form> element for starters.

    Another option you could consider is to just send an email with a link to a web page that contains the form you are trying to send in the email.

    If you would like any more info on sending html email with or without attachments, maybe have a look at this very good tutorial.

    http://www.webcheatsheet.com/php/sen...attachment.php

  3. #3
    Join Date
    Dec 2008
    Posts
    64
    tirna,

    Thanks for the response. Now working on your suggestions by using a link instead.

    Regards
    Adrian

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles