Question for Webman

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

  1. StBalor

    StBalor LawnSite Senior Member
    Messages: 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
    Messages: 5

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

    StBalor LawnSite Senior Member
    Messages: 798

  4. freshfitz

    freshfitz LawnSite Member
    Messages: 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="" name="myform">
  5. Dirty Water

    Dirty Water LawnSite Fanatic
    Messages: 6,794

    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.

    Use the code tags to preserve formatting.
  6. Raven386

    Raven386 LawnSite Silver Member
    from CT
    Messages: 2,169

    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
    Messages: 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
    Messages: 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="" name="myform">
    <input type="hidden" name="success" value="">
    <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>

    <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>

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

    <INPUT TYPE="submit" value="Submit">
  9. Dirty Water

    Dirty Water LawnSite Fanatic
    Messages: 6,794

    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
    Messages: 6,794

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

    // Change this to your e-mail address:
    $myEmail = '';
    // 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