form mail scripting

How do I modify this value so that the online form sends results in the order that they are displayed in the form?  Right now, address 1 comes first, then address 2, city, etc.  I would prefer to have first name, last name, address, etc.  I believe I have to modfiy  the following but I don't know what to put in place of the value=alpha
<input type="hidden" name="form_order" value="alpha"/>

In addition, I would like the form results to appear IN the email body, not as an attachment. Any idea how to do that?

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Final Touch Interiors : SE Wisconsin Interior and Exterior Painting Contractor</title>
<link href="final.css" rel="stylesheet" type="text/css">
</head>

<body id="contact">

<div class="container"><img src="img/roller.png" alt="Final Touch Interiors" class="roller" /><br>

<div class="header"><!-- NAVIGATION - MAIN --><div id="nav_container"><div id="nav"><ul><li class="first"><a href="services.html">Services</a></li><li><a href="gallery.html">Gallery</a></li><li><a href="contact.html">Contact</a></li><li><a href="index.html">Home</a></li></ul></div>
  <a href="index.html"><img src="img/logo.png" width="284" class="logo_splat" height="177" alt="Final Touch Interiors" /></a><a href="index.html"></a><!-- end .header --></div></div>
    
    <div class="sidebar1"><img src="img/t_buehler.jpg" width="306" height="278" alt="" />
      <h2>Low and Zero VOC Paints</h2>
      <p>We care about your health and the environment. Part of our commitment to our customers, our crew, our families and our community is to embrace green products, whenever possible. We offer and encourage the use of low and zero Volatile organic compounds (VOCs) paints and products. </p> 
    
    <!-- end .sidebar1 --></div>
  <div class="content">
    <h1>Contact</h1>
    <p>Call us at (920) 287-2808 for any interior or exterior painting and staining projects.   We are available Monday through Saturday from from 6:00 am to 8:00 pm. No project is too big or too small.</p>
    <p>&nbsp;</p>
    <p>We work around your schedule. Right from your first phone call we will set up an appointment that's convenient for you. Work during the day? That's okay. Got kids to pick up or drop off? No problem - we make appointments for evenings and weekends too.</p>
    <p>&nbsp;</p>
    <p>Complete  the form below and we will contact you shortly.</p>
    
    <!-- BEGIN FORM -->
    
 <form action="/webformmailer.php" method="post"> 
<input type="hidden" name="subject" value="Submission" /> 
<input type="hidden" name="redirect" value="thankyou.html" />
 
    <table cellpadding="5" cellspacing="1" width="100%" class="contactFormTable" style="text-align: left;">
        <tbody>
            <tr>
                <td style=" text-decoration: none; font-weight: normal;" align="left">
               
                <table cellpadding="9" cellspacing="1" width="100%" border="0" class="contactFormTable" style="text-align: left;">
                    <tbody>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_First" controlid="formElement_First">First Name</span></p></td>
                            <td valign="top" > <input type="text" name="FirstName" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_Last" controlid="formElement_Last">Last Name</span></p></td>
                            <td valign="top" ><input type="text" name="LastName" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_Street1" controlid="formElement_Street1">Address Street 1</span></p></td>
                            <td valign="top" ><input id="formElement_Street1" size="30" name="Address Street 1" labelid="formLabel_Street1" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_Street2" controlid="formElement_Street2">Address Street 2</span></p></td>
                            <td valign="top" ><input id="formElement_Street2" size="30" name="Address Street 2" labelid="formLabel_Street2" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_City" controlid="formElement_City">City</span></p></td>
                            <td valign="top" ><input name="City" id="formElement_City" size="30" labelid="formLabel_City" /></td>
                        </tr>
                        <tr>
                          <td valign="top" ><p><span id="formLabel_State2" controlid="formElement_State">State</span></p></td>
                          <td valign="top" ><select id="State" name="State2">
                            <option value="AL" selected="selected">AL</option>
                            <option value="AK">AK</option>
                            <option value="AZ">AZ</option>
                            <option value="AR">AR</option>
                            <option value="CA">CA</option>
                            <option value="CO">CO</option>
                            <option value="CT">CT</option>
                            <option value="DE">DE</option>
                            <option value="DC">DC</option>
                            <option value="FL">FL</option>
                            <option value="GA">GA</option>
                            <option value="HI">HI</option>
                            <option value="ID">ID</option>
                            <option value="IL">IL</option>
                            <option value="IN">IN</option>
                            <option value="IA">IA</option>
                            <option value="KS">KS</option>
                            <option value="KY">KY</option>
                            <option value="LA">LA</option>
                            <option value="ME">ME</option>
                            <option value="MD">MD</option>
                            <option value="MA">MA</option>
                            <option value="MI">MI</option>
                            <option value="MN">MN</option>
                            <option value="MS">MS</option>
                            <option value="MO">MO</option>
                            <option value="MT">MT</option>
                            <option value="NE">NE</option>
                            <option value="NV">NV</option>
                            <option value="NH">NH</option>
                            <option value="NJ">NJ</option>
                            <option value="NM">NM</option>
                            <option value="NY">NY</option>
                            <option value="NC">NC</option>
                            <option value="ND">ND</option>
                            <option value="OH">OH</option>
                            <option value="OK">OK</option>
                            <option value="OR">OR</option>
                            <option value="PA">PA</option>
                            <option value="RI">RI</option>
                            <option value="SC">SC</option>
                            <option value="SD">SD</option>
                            <option value="TN">TN</option>
                            <option value="TX">TX</option>
                            <option value="UT">UT</option>
                            <option value="VT">VT</option>
                            <option value="VA">VA</option>
                            <option value="WA">WA</option>
                            <option value="WV">WV</option>
                            <option value="WI">WI</option>
                            <option value="WY">WY</option>
                          </select></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_Zip" controlid="formElement_Zip">Zip Code </span>(5 digits)</p></td>
                            <td valign="top" >
                              <input name="Zip Code" id="formElement_Zip" size="5" maxlength="5" labelid="formLabel_Zip" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_DaytimePhone" controlid="formElement_DaytimePhone">Daytime Phone</span></p></td>
                            <td valign="top" ><input name="Daytime Phone" id="formElement_DaytimePhone" size="30" labelid="formLabel_DaytimePhone" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_EveningPhone" controlid="formElement_EveningPhone">Evening Phone</span></p></td>
                            <td valign="top" ><input name="Evening Phone" id="formElement_EveningPhone" size="30" labelid="formLabel_EveningPhone" /></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_liamE" controlid="formElement_liamE">Email</span></p></td>
                            <td valign="top" ><input type="text" name="email" /></td>
                        </tr>
                        <tr>
                            <td colspan="1" valign="top" ><p><span id="formLabel_17a53" controlid="formElement_17a53">I would like work on</span></p></td>
                            <td colspan="1" valign="top" ><select id="formElement_17a53" name="I would like work on" size="1">
                            <option value="Interior" selected="selected">Interior</option>
                            <option value="Exterior">Exterior</option>
                             <option value="Commerical">Commercial</option>
                            <option value="Deck/Fence">Deck/Fence</option>
                           <option value="Color Consultation">Color Consultation</option>
                            </select></td>
                        </tr>
                        <tr>
                            <td valign="top" ><p><span id="formLabel_Comments" controlid="formElement_Comments">Project</span> Details</p></td>
                            <td valign="top" ><textarea name="comments" cols="40" rows="10"></textarea></td>
                        </tr>
                        <tr>
                          <td >&nbsp;</td>
                          <td valign="top" ><input type="submit" name="submit" value="Submit"/>&nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" name="reset" value="Reset"/></td>
                        </tr>
                  </tbody>
                </table>
                
              </td>
            </tr>
        </tbody>
    </table>

<input type="hidden" name="form_order" value="alpha"/> <input type="hidden" name="form_delivery" value="hourly_digest"/> <input type="hidden" name="form_format" value="text"/> </form>

  <!-- END FORM -->


    <!-- end .content --></div>
  <div class="footer"><img src="img/logos_memberships.gif" alt="Final Touch Interiors Memberships" width="825" height="144" usemap="#Map" class="logo_memberships" />
    <map name="Map">
      <area shape="rect" coords="268,65,414,102" href="http://www.angieslist.com/companylist/us/wi/sheboygan/final-touch-interiors-reviews-7633653.htm" target="_blank" alt="Angies List">
      <area shape="rect" coords="739,14,822,117" href="http://www.sheboygan.org/" target="_blank" alt="Sheboygan County Chamber of Commerce">
      <area shape="rect" coords="435,7,717,151" href="http://www.sherwin-williams.com/" target="_blank" alt="Sherwin Williams">
      <area shape="rect" coords="-2,33,100,141" href="http://www.sheboyganpress.com" target="_blank" alt="Sheboygan Press Reader's Choice Award">
      <area shape="rect" coords="110,20,259,131" href="http://www.linkedin.com/pub/matt-gardner/48/338/458" target="_blank" alt="Linded In">
    </map>
   
    <!-- end .footer --></div>
  <!-- end .container --></div>
</body>
</html>

Open in new window

(Question edited to put code into the code snippet ~Ray)
contact.html
nsitedesignsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Marco GasiFreelancerCommented:
I think you have to show us webformmailer.php to get an answer...
0
nsitedesignsAuthor Commented:
ah, that doc is blocked.  I cannot make any changes to it.  : (
0
COBOLdinosaurCommented:
Without seeing the whole code there is no way for us to have enough understanding of the context to find a solution.


Cd&
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Ray PaseurCommented:
You can put the question responses into the email body.  Here is my teaching example of a form-to-email script, which does that.

<?php // RAY_form_to_email.php
error_reporting(E_ALL);


// SEND MAIL FROM A FORM


// REQUIRED VALUES ARE PREPOPULATED - CHANGE THESE FOR YOUR WORK
$from = 'NoReply@Your.org';
$subj = 'Contact Form';

// THIS IS AN ARRAY OF RECIPIENTS - CHANGE THESE FOR YOUR WORK
$to[] = 'You@Your.org';
$to[] = 'Her@Your.org';
$to[] = 'Him@Your.org';
$to[] = 'Ray.Paseur@Gmail.com';


// IF THE DATA HAS BEEN POSTED (AT LEAST SOMETHING IN THE EMAIL INPUT CONTROL)
if (!empty($_POST['e']))
{
    // CLEAN UP THE POTENTIALLY BAD AND DANGEROUS DATA
    $safe_mail = clean_string($_POST['e']);
    $safe_name = clean_string($_POST['n']);
    $safe_fone = clean_string($_POST['t']);
    $save_idea = clean_string($_POST['i']);

    // CONSTRUCT THE MESSAGE THROUGH STRING CONCATENATION
    $content    = NULL;
    $content   .= "You have a New Query From $safe_name" . PHP_EOL . PHP_EOL;
    $content   .= "Tel No: $safe_fone" . PHP_EOL;
    $content   .= "Email: $safe_mail" . PHP_EOL;

    // SEND MAIL TO EACH RECIPIENT
    foreach ($to as $recipient)
    {
        if (!mail( $recipient, $subj, $content, "From: $from\r\n"))
        {
            echo PHP_EOL . "<br/>MAIL FAILED FOR $recipient";
        }
        else
        {
            echo PHP_EOL . "<br/>MAIL WORKED FOR $recipient";
        }
    }

    // PRODUCE THE THANK-YOU PAGE
    echo '<p>THANK YOU</p>' . PHP_EOL;
    die('TASK COMPLETE');
}


// A FORM TO TAKE CLIENT INPUT FOR THIS SCRIPT
$form = <<<ENDFORM
<form method="post">
Please enter your contact information
<br/>Email: <input name="e" />
<br/>Phone: <input name="t" />
<br/>Name:  <input name="n" />
<br/>Ideas? <textarea name="i"></textarea>
<br/><input type="submit" />
</form>
ENDFORM;

echo $form;


// A FUNCTION TO CLEAN UP THE DATA - AVOID BECOMING AN OPEN-RELAY FOR SPAM
function clean_string($str)
{
    // IF MAGIC QUOTES IS ON, WE NEED TO REMOVE SLASHES
    $str = stripslashes($str);

    // REMOVE EXCESS WHITESPACE
    $rgx
    = '#'                // REGEX DELIMITER
    . '\s'               // MATCH THE WHITESPACE CHARACTER(S)
    . '\s+'              // MORE THAN ONE CONTIGUOUS INSTANCE OF WHITESPACE
    . '#'                // REGEX DELIMITER
    ;
    $str = preg_replace($rgx, ' ', $str);

    // REMOVE UNWANTED CHARACTERS
    $rgx
    = '#'                // REGEX DELIMITER
    . '['                // START OF A CHARACTER CLASS
    . '^'                // NEGATION - MATCH NONE OF THE CHARACTERS IN THIS CLASS
    . 'A-Z0-9'           // KEEP LETTERS AND NUMBERS
    . '"'                // KEEP DOUBLE QUOTES
    . "'"                // KEEP SINGLE QUOTES
    . '@&+:?_.,/\-'      // KEEP SOME SPECIAL CHARACTERS (ESCAPED HYPHEN)
    . ' '                // KEEP BLANKS
    . ']'                // END OF THE CHARACTER CLASS
    . '#'                // REGEX DELIMITER
    . 'i'                // CASE-INSENSITIVE
    ;
    $str = preg_replace($rgx, NULL, $str);

    // REMOVE EXCESSIVE INPUT
    $str = substr($str, 0, 255);

    return trim($str);
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Dave BaldwinFixer of ProblemsCommented:
It turns out that data 'posted' thru a browser is not necessarily sent in the order you see it in the form.  'webformmailer.php' (and 'formmail.pl') just take what they are given and pass it on.  If you want it in a certain order in your email, you have to write a custom script that does what you want.

Also, 'webformmailer.php' on Godaddy is a major target for spammers since it is installed on every Godaddy web site.  Since I always write my own forms, I always delete it.
0
nsitedesignsAuthor Commented:
Ray, thanks for the code but I do not have access to php so I am unable to make any changes.  I would have thought that I could simply change the <input type="hidden" name="form_order" value="alpha"/> to something other than "alpha" but I guess that is not the case.  

Dave,
Client was not interested in any type of online form that would cost extra.  I cautioned him  that he would open himself up to a lot of spam.
0
Dave BaldwinFixer of ProblemsCommented:
I found one remaining copy of 'webformmailer.php' on my computer.  All it does is package up the form variables into a file and puts the file in an email 'pickup' directory for a server process to pick it up and mail it as an attachment.
0
Ray PaseurCommented:
I do not have access to php...
You can't install any PHP scripts on the site?  I would be very surprised if that were true.  I'm suggesting that you replace the webformailer.php script with something of your own.  Then you can get the mail into any format that makes sense for your needs.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.