Discussion:
Handling an email form
Jim Giner
2014-01-19 16:40:23 UTC
Permalink
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.

For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.

What's the trick - or can't this be done?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Aziz Saleh
2014-01-19 17:06:20 UTC
Permalink
I can create a valid html email containing a form and an input and submit
tag in it. With this I wish to call a script on my website and have it
take the value of the input and update a record in a mysql table. The
concept is pretty straight-forward, but I'm having no luck with the
execution.
For one thing - my email client insists on opening a new browser window as
soon as I click on the input tag. That is probably some email setting that
I'll have to dig into. And it does it again when I click on the submit
button. But the real problem is that the script called from this email
form doesn't seem to respond. I have tested the form right from my website
and it manages to call the script correctly and I have echoed out my
progress to verify my code works, but it just doesn't happen from the email.
What's the trick - or can't this be done?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
For obvious reasons (phishing is one I can think of right off the bat)
most email provides will strip out all form tags, let alone allow you to
actually submit it in new tab. I would say your email service got it right
to not process the request. I would be worry about an email service that
allows such thing.
Jim Giner
2014-01-19 21:16:38 UTC
Permalink
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.

1 - Can't seem to 'send' that email (html) form back to my target
mailbox. Nor can I forward that mailbox to a php script and receive the
post data.

2 - Can however change the form's action to be a 'mailto:' which DOES
capture the post data from the form and send it as a GET string in a
brand new email with the 'mailto' address all setup in the new email.
With that, I can then just hit 'send' and the email goes to my
designated mailbox where I can then execute my script to process the
parms in the body of the message and my problem is solved.

So - it's not complete automated, but it's two click to create it and
send it, then another on my website to process any outstanding emails in
that inbox.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stuart Dallas
2014-01-19 22:11:01 UTC
Permalink
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox. Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES capture the post data from the form and send it as a GET string in a brand new email with the 'mailto' address all setup in the new email. With that, I can then just hit 'send' and the email goes to my designated mailbox where I can then execute my script to process the parms in the body of the message and my problem is solved.
So - it's not complete automated, but it's two click to create it and send it, then another on my website to process any outstanding emails in that inbox.
What do you have against hosting the form on a website? It seems to me that you're attempting to get a hammer to screw in a screw. You'll be able to do it in some fashion or other, but it's going to be messy and potentially unstable.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-01-20 14:10:01 UTC
Permalink
Post by Stuart Dallas
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox. Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES capture the post data from the form and send it as a GET string in a brand new email with the 'mailto' address all setup in the new email. With that, I can then just hit 'send' and the email goes to my designated mailbox where I can then execute my script to process the parms in the body of the message and my problem is solved.
So - it's not complete automated, but it's two click to create it and send it, then another on my website to process any outstanding emails in that inbox.
What do you have against hosting the form on a website? It seems to me that you're attempting to get a hammer to screw in a screw. You'll be able to do it in some fashion or other, but it's going to be messy and potentially unstable.
-Stuart
The whole process is that I use my website to host and maintain an
inventory of wines. At shopping time I generate an email of those
bottles I want to purchase. At the store I use that list on my phone to
gather my purchases. Prior to this I then went back to my site and
sorted thru my bottles and updated the inventory - one by one. With
this idea my shopping list has the inputs built in to it and I can
complete the update process very quickly as I complete my shopping trip.
Of course since I can't actually handle the form I have to use an
email but it's still easier than the old method.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Stuart Dallas
2014-01-20 14:22:44 UTC
Permalink
Post by Stuart Dallas
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox. Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES capture the post data from the form and send it as a GET string in a brand new email with the 'mailto' address all setup in the new email. With that, I can then just hit 'send' and the email goes to my designated mailbox where I can then execute my script to process the parms in the body of the message and my problem is solved.
So - it's not complete automated, but it's two click to create it and send it, then another on my website to process any outstanding emails in that inbox.
What do you have against hosting the form on a website? It seems to me that you're attempting to get a hammer to screw in a screw. You'll be able to do it in some fashion or other, but it's going to be messy and potentially unstable.
-Stuart
The whole process is that I use my website to host and maintain an inventory of wines. At shopping time I generate an email of those bottles I want to purchase. At the store I use that list on my phone to gather my purchases. Prior to this I then went back to my site and sorted thru my bottles and updated the inventory - one by one. With this idea my shopping list has the inputs built in to it and I can complete the update process very quickly as I complete my shopping trip. Of course since I can't actually handle the form I have to use an email but it's still easier than the old method.
I think I would put the whole thing on a web page and take email out of the equation. Seems to me that would simplify the whole thing. Either that or look into the multitude of apps out there that facilitate list management.

-Stuart
--
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-01-20 14:36:26 UTC
Permalink
To each their own. For me this is exactly what is needed.
Post by Stuart Dallas
Post by Stuart Dallas
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox. Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES capture the post data from the form and send it as a GET string in a brand new email with the 'mailto' address all setup in the new email. With that, I can then just hit 'send' and the email goes to my designated mailbox where I can then execute my script to process the parms in the body of the message and my problem is solved.
So - it's not complete automated, but it's two click to create it and send it, then another on my website to process any outstanding emails in that inbox.
What do you have against hosting the form on a website? It seems to me that you're attempting to get a hammer to screw in a screw. You'll be able to do it in some fashion or other, but it's going to be messy and potentially unstable.
-Stuart
The whole process is that I use my website to host and maintain an inventory of wines. At shopping time I generate an email of those bottles I want to purchase. At the store I use that list on my phone to gather my purchases. Prior to this I then went back to my site and sorted thru my bottles and updated the inventory - one by one. With this idea my shopping list has the inputs built in to it and I can complete the update process very quickly as I complete my shopping trip. Of course since I can't actually handle the form I have to use an email but it's still easier than the old method.
I think I would put the whole thing on a web page and take email out of the equation. Seems to me that would simplify the whole thing. Either that or look into the multitude of apps out there that facilitate list management.
-Stuart
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jasper Kips
2014-01-20 16:04:46 UTC
Permalink
Basically, when you want to submit the form, your e-mail client needs to build a http(s) connection. From what you say, you build a html form, send it by mail, it gets filled in, and then when you send it, it needs the browser to handle the http(s) connection.

If you change the url in the form to a mailto: form, it will do the trick. I.e. it will send it as mail. Now you have to make sure, the mail gets handled on the side of the mail-server. That is not an easy task to build. Personally I would do the whole thing in http(s), but that doesn't seem possible for you.

And yes to all it's own, but it seems rather cumbersome.
You use two protocols, (mail and http) and mix them up. It is a bit like wanting to send an sms by voice, instead of text.

--Jasper
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox. Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES capture the post data from the form and send it as a GET string in a brand new email with the 'mailto' address all setup in the new email. With that, I can then just hit 'send' and the email goes to my designated mailbox where I can then execute my script to process the parms in the body of the message and my problem is solved.
So - it's not complete automated, but it's two click to create it and send it, then another on my website to process any outstanding emails in that inbox.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-01-20 17:06:16 UTC
Permalink
I'm sorry everyone feels like I've made a mess of things here, but it's
written and it works just fine.

1 My site sends an email containing html.
2 I go shopping and check off my purchases in the email form.
3 At the end of my shopping, I hit the submit button in the email form
which now immediately creates a new email with all the data entries as
simple get-like args which I then simply hit send on.
4 My website script then processes this incoming email and posts the
purchases to my database.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Peter West
2014-01-21 13:26:01 UTC
Permalink
Not everyone.

Peter West

"Those who are well have no need of a physician, but those who are sick..."
I'm sorry everyone feels like I've made a mess of things here, but it's written and it works just fine.
1 My site sends an email containing html.
2 I go shopping and check off my purchases in the email form.
3 At the end of my shopping, I hit the submit button in the email form which now immediately creates a new email with all the data entries as simple get-like args which I then simply hit send on.
4 My website script then processes this incoming email and posts the purchases to my database.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-01-20 17:02:38 UTC
Permalink
I'm sorry everyone feels like I've made a mess of things here, but it's
written and it works just fine.

1 My site sends an email containing html.
2 I go shopping and check off my purchases in the email form.
3 At the end of my shopping, I hit the submit button in the email form
which now immediately creates a new email with all the data entries as
simple get-like args which I then simply hit send on.
4 My website script then processes this incoming email and posts the
purchases to my database.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
tamouse pontiki
2014-01-21 12:03:49 UTC
Permalink
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox.
Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES
capture the post data from the form and send it as a GET string in a brand
new email with the 'mailto' address all setup in the new email. With that, I
can then just hit 'send' and the email goes to my designated mailbox where I
can then execute my script to process the parms in the body of the message
and my problem is solved.
So - it's not complete automated, but it's two click to create it and send
it, then another on my website to process any outstanding emails in that
inbox.
Does the query string length limitation matter in this case?
Post by Jim Giner
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Jim Giner
2014-01-21 14:07:42 UTC
Permalink
Post by tamouse pontiki
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox.
Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES
capture the post data from the form and send it as a GET string in a brand
new email with the 'mailto' address all setup in the new email. With that, I
can then just hit 'send' and the email goes to my designated mailbox where I
can then execute my script to process the parms in the body of the message
and my problem is solved.
So - it's not complete automated, but it's two click to create it and send
it, then another on my website to process any outstanding emails in that
inbox.
Does the query string length limitation matter in this case?
Post by Jim Giner
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I perhaps misled you with my reference to GET. Actually it seems to
grab my input tag contents and create what LOOKS like the query portion
of a normal GET URL. In this case it is just a string that looks like this:

pq_qty_20=22&pq_qty_18=18&pq_qty_19=19&btn=Post+Email+Purchases

So - with this my script simply breaks it down by "&" and then by "=" to
get my values for updating my db. In this case there are 3 sets of data
to do updates with.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
tamouse pontiki
2014-01-22 22:37:09 UTC
Permalink
Post by tamouse pontiki
Post by Jim Giner
Post by Jim Giner
I can create a valid html email containing a form and an input and
submit tag in it. With this I wish to call a script on my website and
have it take the value of the input and update a record in a mysql
table. The concept is pretty straight-forward, but I'm having no luck
with the execution.
For one thing - my email client insists on opening a new browser window
as soon as I click on the input tag. That is probably some email
setting that I'll have to dig into. And it does it again when I click
on the submit button. But the real problem is that the script called
from this email form doesn't seem to respond. I have tested the form
right from my website and it manages to call the script correctly and I
have echoed out my progress to verify my code works, but it just doesn't
happen from the email.
What's the trick - or can't this be done?
Well - for those with an interest here is what I have found.
1 - Can't seem to 'send' that email (html) form back to my target mailbox.
Nor can I forward that mailbox to a php script and receive the post data.
2 - Can however change the form's action to be a 'mailto:' which DOES
capture the post data from the form and send it as a GET string in a brand
new email with the 'mailto' address all setup in the new email. With that, I
can then just hit 'send' and the email goes to my designated mailbox where I
can then execute my script to process the parms in the body of the message
and my problem is solved.
So - it's not complete automated, but it's two click to create it and send
it, then another on my website to process any outstanding emails in that
inbox.
Does the query string length limitation matter in this case?
Post by Jim Giner
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
I perhaps misled you with my reference to GET. Actually it seems to grab my
input tag contents and create what LOOKS like the query portion of a normal
pq_qty_20=22&pq_qty_18=18&pq_qty_19=19&btn=Post+Email+Purchases
So - with this my script simply breaks it down by "&" and then by "=" to get
my values for updating my db. In this case there are 3 sets of data to do
updates with.
Where/how does that query-like string show up? Is it in the e-mail
message body? I guess I could just give it a go and try it...
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
tamouse pontiki
2014-01-22 22:54:38 UTC
Permalink
I guess I'm not understanding how this works. Could you explain how your
email form is set up? If I put in

<form action="mailto:***@gmail.com">

for example (with the input elements and a submit button), when I click the
submit, it opens up a new email to fill out. In GMail, it asks if I want to
create a new email, and then opens the message to send in another tab with
empty fields.

How are you getting the form to actually submit something?
Ford, Mike
2014-01-23 16:48:16 UTC
Permalink
-----Original Message-----
Sent: 21 January 2014 14:08
I perhaps misled you with my reference to GET. Actually it seems to
grab my input tag contents and create what LOOKS like the query portion
pq_qty_20=22&pq_qty_18=18&pq_qty_19=19&btn=Post+Email+Purchases
So - with this my script simply breaks it down by "&" and then by "=" to
get my values for updating my db. In this case there are 3 sets of data
to do updates with.
You may want to consider PHP's parse_str() function...?


Cheers!

Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
403a Leslie Silver Building, City Campus, Leeds Metropolitan University,
Woodhouse Lane, LEEDS, LS1 3ES, United Kingdom
E: ***@leedsmet.ac.uk T: +44 113 812 4730







To view the terms under which this email is distributed, please go to http://disclaimer.l
Continue reading on narkive:
Loading...