Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

I need help with a java/html form intergration problem.?

Ok here is my code so far

<form action="mailto:**********@*****.***" method="get" name="Start Now">

<span style="color: black;">Please fill out the following form, to get a quote and get started.</span>

<br>

<br>

Personal/Contact Info<br>

<table style="text-align: left; width: 400px; height: 128px;" border="0" cellpadding="2" cellspacing="2">

<tbody>

<tr>

<td style="height: 40px; width: 150px;"><input name="Name"></td>

<td style="height: 40px; width: 230px;">Your Name</td>

</tr>

<tr>

<td style="height: 40px; width: 150px;"><input name="Email"></td>

<td style="height: 40px; width: 230px;">Your Email Address</td>

</tr>

<tr>

<td style="height: 40px; width: 150px;"><input name="Phone#"></td>

<td style="height: 40px; width: 230px;">Your Phone Number</td>

</tr>

</tbody>

</table>

<input onclick="alert('Thank you for your time, _______, we will get in touch with you within three buiesness days')" value="SUBMIT" name="submit" id="submit" type="submit">

what i want it to do is, have the pop up "barrow" the users name from the form and and get it to put the name in between the comma's.

Also when you hit submit on this form it submits through your primarry email program on your computer, how do i make it so it sends directly to my email from my website.

Thank you in advance

2 Answers

Relevance
  • Anonymous
    1 decade ago
    Favorite Answer

    Meh...

    write a function out, declare your variables.

    function nameAlerter(){

    var x = document.getElementById('nameInput');

    alert("Thank you for your time,"

    + x.value +

    ", we will get in touch with you within three business days.");

    }

    add id="nameInputu" to your <input name="Name"> field

    add onsubmit="nameAlerter();" to your form...

    so now it's...

    <script type="text/javascript">

    function nameAlerter(){

    var x = document.getElementById('nameInput');

    alert("Thank you for your time,"

    + x.value +

    ", we will get in touch with you within three business days.");

    }

    </script>

    <form action="

    mailto:blahblah"

    method="get"

    name="Start Now"

    onsubmit="nameAlerter();">

    <input type="Name" id="nameInput">

    <input value="Submit" name="Submit" type="Submit">

    that's it, and you're done.

    ***********************************EDIT***************************************

    I didn't see your question about 'how to stop opening Outlook when submitting the form!'.

    Oh believe me, I understand your frustration, let's go over a few things.

    #1 - Something has to 'read' that data you placed into those <input> fields, then parse that data, then send it in an email.

    #2 - What would do something like that? Why a server-side scripting language of course!

    #3 - So..what do I do now? Well - you test to see whether or not your web host allows PHP (one of the easiest imo). Simply open up notepad and copy this ->

    <?php

    phpinfo();

    ?>

    then save this file as 'phpinfo.php'.

    Upload this file to your websites, then access it like ->

    http://www.mysite.com/phpinfo.php

    If you get a 'download' prompt, no php installed.

    If you get a bunch of information, we're good to move on to step #4

    #4 - So I have php, what does that mean? That means we can read out your data in your form, parse that data into 'strings', then pass that information along through the server, directly to your email, without you doing anything more than clicking submit.

    #5 - that sounds awesome. how many years of college do I need for this? None! This is a very simple process, please see the steps outlined below:

    First, we need to create a php document that will accept our information.

    We will call this 'thank-you.php'

    Now, we will modify our form, so it looks like this ->

    <form action="thank-you.php" method="post" name="Start Now">

    //input fields go here

    </form.

    You'll notice that in our action, instead of using mailto: we're using a .php document.

    Now inside of this PHP document, we'll need to make some changes.

    <?php

    //the above tag opens a PHP docuemnt so we may begin to manipulate the doc with PHP scripting.

    //now we start to pass our variables over from our form

    $email = $HTTP_POST_VARS[Email];

    $mailto = "myemailaddress@myemail.com";

    $mailsubject = "Form Submission";

    $mailername = "$_POST['Name']";

    $mailhead = "From :$email\n";

    reset ($HTTP_POST_VARS);

    $mailbody = "Values from the website form are found below:\n";

    while(list($key, $val) = each($HTTP_POST_VARS)) {$mailbody .="$key : $val\n";}

    if(!eregi("\n", $HTTP_POST_VARS[Email])) {mail($mailto, $mailsubject, $mailbody, $mailhead);}

    //now that we've built all of our variables, we can do your 'thank you' message now.

    echo "Thank you for your time, " .$mailername. ", we will get ni touch with you within three business days.";

    ?>

    So now, we're submitting the form, to the php document.

    Everything you see with a $ in front of it is a variable, that we declare, by writing out the definition FOLLOWING the ='s sign.

    Now, you'll get an email, with the subject, body, and header attached, with a return address too.

    Not bad for less than 15 lines of code.

  • 1 decade ago

    There's is no Java in this code....I think you meant JavaScript

Still have questions? Get your answers by asking now.