These are both possible, although I will warn you about the first one – the last time I used that trick to fill out an e-mail, my Mac gave me a sternly worded warning dialog before allowing me to open my mail app with the pre-filled message. It’s easy to do, but possibly going the way of the dinosaur on account of security and privacy concerns.
To create a mail message with a pre-filled subject line, all you need to do is create a link with this kind of URL:
mailto:someone(a)somewhere.dom?subject=Product+Name+Here
Notice the plus signs replacing the spaces. This is known as a URL-encoded string. A URL cannot contain spaces, and certain characters have special meaning and so need to be escaped if they are being used innocently (without that meaning intended).
Also (if you’re reading this in a mail application) I replaced the @ sign in the address with parentheses around an a. That was just for the benefit of the Web archive of this list. If I don’t do that, it would turn the address into “email (at) hidden”. So don’t do that, it’s not part of the scheme.
To get a link to fill in a form, you’re going to need to use a programming language like PHP on your form page. You won’t need PHP on the page that links to the form, just on the form page itself. The trick is to intercept a variable passed in the link and then write it into the form page while the page is loading.
The link would look like this:
http://example.com/form_page.php?product=Product+Name+Here
On the form page (which you would rename from .html to .php, as above) you would catch that “product” variable somewhere above the visible page like this:
<?php $product = $_GET['product'] || ""; ?>
Then, in the form element where you want $product to appear, you would make the value
property of the text field read <?php echo urldecode($product); ?>
. Now if someone comes to that form page without the ?product=whatever part in their URL, the field is blank, but if they have that value in the URL, whatever is in there will appear in the form field on the page, like magic.
Walter
On Aug 30, 2019, at 5:37 AM, Matt Covarr email@hidden wrote:
Hi, I would like to set up a process on a freeway website, whereby a user can view a product, click on an Enquire Now button and either:
- Open an email with the product name within the email subject.
or
- Open a form with the product name pre-populated into one of the form fields.
Can this be be done?
Look forward to any feedback.
freewaytalk mailing list
email@hidden
Update your subscriptions at:
Information for existing FreewayTalk / Groups.io users - Site Feedback - Softpress Talk
freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options