2

my first post here. I've been trying to create and emailable HTML form that will send information to an internal ticketing system. The form needs to contain specific pieces of information - hence the form menus - and a subject where people can write the description. Right now, I've tried to create an email template using outlook for the purposes but I haven't found a way to make my information show up correctly.

Instead I've just been using an HTML java script form but I can't quite get it to allow the user to both change the subject and send the information from the form. Can anyone help? I'm willing to have a go at any method of sending the form that people think might work, my current approch is kind of awkward.

Current non-functional attempt. I'm fairly new at this and any help, direction or linking me to a place where I might find stuff that could help me work this out would be appreciated.

Edit: I should add that the html form is running locally on people's machines, I suspect this means that I'd have to install any languages people would use to do this via a server on every computer that uses the form, not tried this though.

Edit 2: Update, trying jquery, but isn't working. Not used before at all. Looking online now but can anyone save me some time and tell me what stupid mistake am I making that's invalidating this?

Edit 3: Fixed syntax, still not working though

<!DOCTYPE html>
<html>

<head>
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.9.1.min.js">
$(function (){
$("#test").submit(function (){
$(this).attr('action','mailto:test@email.com?subject=' + $("#sub").val());
});
});    
</script>
</head> 

<body>

<form method="get" enctype="text/plain" id="test">
  <input type = "text" name = "sub" id = "sub" size = "44">
  <select name="Test">
   <option value="test1">test1</option>
   <option value="test2">test2</option>
   <option value="test3">test3</option>
   <option value="test4">test4</option>
  </select>
</form>

</body>
</html>
ePigeon
  • 121
  • 1
  • 3

2 Answers2

0

You could look into the PHP mail function: http://www.php.net/manual/en/book.mail.php

But also, look into why that is a bad idea, there are potential security risks: Why shouldn't I use PHP's mail() function?

Community
  • 1
  • 1
marlonp33
  • 139
  • 2
  • 11
-1

With Jquery it's very easy

<form method="get" enctype="text/plain" id="test">
  <input type = "text" name = "sub" id = "sub" size = "44">
  <select name="Test">
   <option value="test1">test1</option>
   <option value="test2">test2</option>
   <option value="test3">test3</option>
   <option value="test4">test4</option>
  </select>
</form>

Jquery

$(function (){
 $("#test").submit(function (){
    $(this).attr('action','mailto:test@email.com?subject=' + $("#sub").val());
 });
});

But I would advice you to use server side client mailing. Example with php

Robert
  • 19,800
  • 5
  • 55
  • 85