1. Missed the live Ask the Expert event?
    Not to worry. Check out the archived thread of the Q&A with Ken Hutcheson, President of U.S. Lawns, and the LawnSite community on the Franchising Forum.

    Dismiss Notice

Question for Webman

Discussion in 'Digital Marketing' started by StBalor, Mar 18, 2007.

  1. StBalor

    StBalor LawnSite Senior Member
    Posts: 798

    1st off i would like to say thanks for pointing me in the right direction on my stats page in my cpanel.
    I have been trying to create a form people can fill out and submit and it will go to my email. But it's not working. Whenever i press the submit button i get an error.
    I know you could not figure out the problem just by what i said above. But if your willing to look at it, i could send you the page.
     
  2. freshfitz

    freshfitz LawnSite Member
    Posts: 5

    Whats the error your getting?
    Can you send me the url of the form?
     
  3. StBalor

    StBalor LawnSite Senior Member
    Posts: 798

  4. freshfitz

    freshfitz LawnSite Member
    Posts: 5

    How did you program this cause you are posting the results to a .txt file which doesn't make any sense

    <form method="POST" action="http://www.sunvalleylawnservice.com/Estimate.txt" name="myform">
     
  5. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,799

    Estimate.txt is actually in the cgi-bin directory which makes me think its a perl file.

    Your going to have to post the code, for my to find your problem, you can use the code tags.

    Code:
    Use the code tags to preserve formatting.
    
     
  6. Raven386

    Raven386 LawnSite Silver Member
    from CT
    Posts: 2,160

    just a thought on your site.......i would take off how much you are insured for. just leave it that you have insurance.
     
  7. StBalor

    StBalor LawnSite Senior Member
    Posts: 798


    I have tried lots of different ways to get this to work. Followed a few tutorials. they did not explain things very well so this is what i ended up with this time before i gave up.
    I have no idea how to get this to work, i have had many error messages, this just happens to be the last.
     
  8. StBalor

    StBalor LawnSite Senior Member
    Posts: 798

    Ok, here is the code. I changed it a bit since i last posted. Seems to be the closest i have been so far.

    <form method="get" action="http://www.sunvalleylawnservice.com/Estimate.htm" name="myform">
    <input type="hidden" name="success" value="estimate@sunvalleylawnservice.com">
    <b><center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Please Fill Out All Fields</center></B><br>
    &nbsp;&nbsp;&nbsp;First and Last Name:<br>
    &nbsp;&nbsp;&nbsp;<input type="text" name="name" size=25 maxlength=50><br><br>

    &nbsp;&nbsp;&nbsp;Email Address:<br>
    &nbsp;&nbsp;&nbsp;<input type="text" name="email" size=25 maxlength=50><br><br>

    &nbsp;&nbsp;&nbsp;Street Address:<br>
    &nbsp;&nbsp;&nbsp;<input type="text" name="address" size=25 maxlength=50><br><br>

    &nbsp;&nbsp;&nbsp;City of Residence:<br>
    &nbsp;&nbsp;&nbsp;<input type="text" name="city" size=25 maxlength=50><br><br>

    &nbsp;&nbsp;&nbsp;Zip Code:<br>
    &nbsp;&nbsp;&nbsp;<input type="text" name="zip" size=25 maxlength=50><br><br>

    &nbsp;&nbsp;&nbsp;Phone:<br>
    <input type="text" name="area" size=4 maxlength=3> -
    <input type="text" name="exchange" size=4 maxlength=3> -
    <input type="text" name="number" size=5 maxlength=4><br><br>

    &nbsp;&nbsp;&nbsp;Plan Selection:<br>
    <select name="Basic Lawn Service">
    <option value="Basic Lawn Service">Basic Lawn Service</option>
    <option value="SVLS Lawn Package">SVLS Lawn Package</option>
    <option value="Custom Lawn Package">Custom Lawn Package</option>
    <option value="Complete Lawn Package">Complete Lawn Package</option>
    </select><br><br>

    &nbsp; Other Services: Use as much detail as possible.<br>
    <textarea name="Other Services:" rows="4"></textarea><br><br>

    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <INPUT TYPE="submit" value="Submit">
    </form>
     
  9. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,799

    Please paste whatever the file in the action property of the form tag is.

    Tell me also if your server has PHP and SendMail installed.
     
  10. Dirty Water

    Dirty Water LawnSite Fanatic
    Posts: 6,799

    Here is a PHP script I just wrote to help you out:

    Code:
    <?php
    
    // Change this to your e-mail address:
    
    $myEmail = 'email@email.com';
    
    // Gather Form Data into variables
    $name = $_POST['name'];
    $email = $_POST['email'];
    $address = $_POST['address'];
    $city = $_POST['city'];
    $zip = $_POST['zip'];
    
    $phonearray = array($_POST['area'],$_POST['exchange'],$_POST['number']);
    
    // Parse the phone number into one variable with hyphens.
    $phonenumber = implode('-',$phonearray);
    
    // Remove the spaces in the names in your HTML form to match these:
    
    $service = $_POST['BasicLawnService'];
    $other = $_POST['OtherServices'];
    
    // E-mail variables
    
    $subject = 'Automated Estimate Request from Website';
    
    // Build the e-mail message:
    $message = "Name: $name \n Email: $email \n Address: $address \n City: $city \n ZipCode: $zipcode \n \n Phone Number: $phonenumber \n \n Service Requested: $service \n \n Other Services: $other";
    
    // Send mail
    mail ($myEmail, $subject, $message);
    ?>
    
    I didn't test run this, but it should work.
     

Share This Page