0
votes

I am trying to implement Net Promoter Score survey through email body. As email clients don't allow Javascript. I want to submit the radio button value to a url that is defined in Form Action attribute.

But my question is how to know which radio button is checked, and how to submit it to a remote url ? and in which form will it be submitted ? i.e name value pair or how ?

Note: I know how Jquery and Ajax. I want to achieve same things without using Ajax or Jquery or Javascript

2
Can you submit a form from email client? - Martin Gottweis
Yes apparently you can, i have a seen them being done by other websites in their user survey form. - Style Raver

2 Answers

1
votes

A standard HTML form submission should handle this fine

Make sure your radio buttons all have the same name attribute, and give them all a different value attribute

Include an input with type="submit" and the resulting form submission should have NameOfAllRadioButtons = ValueOfSelectedRadioButton

I don't think I've ever been sent an email with form inputs in the body, which probably means there are a lot of clients that don't support them at all. You might be better off sending a link to take the survey in an actual web page.

0
votes

According to this article: https://www.sitepoint.com/forms-in-email/ you should be able to use a standard html form in an email. Outlook will display the form messed up though.

To get radio value, just do this:

<form action="/yoururl.php" method="get">
    <input type="radio" name="question" value="answer1" checked> answer1<br>
    <input type="radio" name="question" value="answer2"> answer2<br>
    <input type="submit">
</form>

In your backend code, you will be able to do $_GET["question"] to get either answer1 or answer2.

On submit user will be redirected to another page and most client will probably ask for confirmation before redirecting.