/    Sign up×
Community /Pin to ProfileBookmark

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

[code=php]

$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” . “rn”;
$headers .= “Content-type:text/html;charset=iso-8859-1” . “rn”;

mail($to,$subject,$txt,$headers);
[/code]

.
Is it to do with the email headers being incomplete or wrong?
Thanks in advance

Adrian

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@tirnaMar 31.2010 — 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 [B]must have[/B] 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.

[URL]http://www.webcheatsheet.com/php/send_email_text_html_attachment.php[/URL]
Copy linkTweet thisAlerts:
@myminimonsterauthorApr 01.2010 — tirna,

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

Regards

Adrian
×

Success!

Help @myminimonster spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...