2014-04-09 08:10
浏览 27


I have a HTML form within one of my webpages, and i am now having trouble configuring it to the sendmail.php. When I fill in the form, and click submit, its asking me to save the file 'sendmail.php' but I want it to send to the email specified in the 'sendmail.php' file.

in my 'sendmail.php' file I currently have:

$element_1_1 = $_POST['element_1_1'];
$element_1_2 = $_POST['element_1_2'];

$to = ""; // this is your Email address
$from = $_POST['element_4']; // this is the sender's Email address
$first_name = $_POST['element_1_1'];
$last_name = $_POST['element_1_2'];
$subject = "Form submission";
$message = $element_1_1 . " " . $element_1_2 . " Has Sent A Quote Request";

$element_2 = $_POST['element_2'];
$element_3 = $_POST['element_3'];
$element_4 = $_POST['element_4'];
$element_5_1 = $_POST['element_5_1'];
$element_5_2 = $_POST['element_5_2'];
$element_5_3 = $_POST['element_5_3'];
$element_5_4 = $_POST['element_5_4'];
$element_5_5 = $_POST['element_5_5'];
$element_5_6 = $_POST['element_5_6'];
  mail ($to,$element_4,$element_2,$element_3,$element_4,$element_5,$element_5_1,$element_5_2,$element_5_3,$element_5_4,$element_5_5,$element_5_6);
 echo " Thank you " . $first_name . ", One of our sales team is dealing with you're request! We will contact you shortly.";


and the html form is as follows:

    <form id="form_824601" class="appnitro"  method="post" action="sendmail.php">                   
        <ul >

    <li id="li_1" >
    <label class="description" for="element_1">Name </label>
        <input id="element_1_1" name= "element_1_1" class="element text" maxlength="255" size="8" value=""/>
        <input id="element_1_2" name= "element_1_2" class="element text" maxlength="255" size="14" value=""/>

    <li id="li_2" >
    <label class="description" for="element_2">Company Name </label>
        <input id="element_2" name="element_2" class="element text medium" type="text" maxlength="255" value=""/> 

    <li id="li_3" >
    <label class="description" for="element_3">Enter Contact Telephone Number </label>
        <input id="element_3" name="element_3" class="element text medium" type="text" maxlength="255" value=""/> 

    <li id="li_4" >
    <label class="description" for="element_4">Enter Email Address </label>
        <input id="element_4" name="element_4" class="element text medium" type="text" maxlength="255" value=""/> 

    <li id="li_5" >
    <label class="description" for="element_5">Request A Quote For ... </label>
        <input id="element_5_1" name="element_5" class="element radio" type="radio" value="1" />
<label class="choice" for="element_5_1">Web Design</label>
<input id="element_5_2" name="element_5" class="element radio" type="radio" value="2" />
<label class="choice" for="element_5_2">SEO</label>
<input id="element_5_3" name="element_5" class="element radio" type="radio" value="3" />
<label class="choice" for="element_5_3">Social Media</label>
<input id="element_5_4" name="element_5" class="element radio" type="radio" value="4" />
<label class="choice" for="element_5_4">Graphic Design</label>
<input id="element_5_5" name="element_5" class="element radio" type="radio" value="5" />
<label class="choice" for="element_5_5">Video Marketing</label>
<input id="element_5_6" name="element_5" class="element radio" type="radio" value="6" />
<label class="choice" for="element_5_6">Maintenance</label>


    <li class="buttons">
            <input type="hidden" name="form_id" value="824601" />

            <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />

I Hope someone can shed light on the issue I'm having!!

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duanqian6295
    duanqian6295 2014-04-09 08:43

    This will never work while you are running the script locally. You need to run it on a server that can handle PHP. The only way you could run it locally and that is if you have a local web server set up.

    I hope this helps!

    点赞 评论
  • duangouyan3328
    duangouyan3328 2014-04-09 08:49

    You can't run .php files just from the folder, you will need a web server to handle it for you. if you are running windows or mac , you can set one up using software like XAMPP (win + osx) , WAMP (win) , MAMP (osx).

    If you happen you run a linux distribution, you can set up a LAMP server.

    Here are some links:

    From the links above, xampp has always worked out the best for me performance wise. parsing a huge xml feed and putting it into a mysql database takes like half the time on xampp compared to wamp.

    点赞 评论