mcdade Posted August 9, 2010 Share Posted August 9, 2010 if anyone out there fancy's helping the needy please can you cast your eyes over my mess! and possibly help me find my way out of this maze? So im useing a third party form, and a third party php script.......... cant get them to work together . form script : <form action="phpquote.php" method="post" id="reserve-form"> <div class="box"> <div class="left-top-corner"> <div class="right-top-corner"> <div class="border-top"></div> </div> </div> <div class="border-left"> <div class="border-right"> <div class="xcontent"> <h5>Get an online quote for your journey</h5> <p>please fill in all fields for your quote.</p> <fieldset> <div class="field"> <label>Customer Information</label> <input type="text" id="name" value="Name" onblur="if(this.value==''){this.value='Name'}" onfocus="if(this.value=='Name'){this.value=''}" /> </div> <div> <input type="text" id="number" value="Phone" onblur="if(this.value==''){this.value='Phone'}" onfocus="if(this.value=='Phone'){this.value=''}" /> </div> </fieldset> <fieldset class="style1"> <div class="field"> <label>Travel Date/ Time</label> <select id="year"> <option>2010</option> <option>2011</option> </select> <select class="sel-1" id="month"> <option>Jan</option> <option>Feb</option> <option>Mar</option> <option>Apr</option> <option>May</option> <option>Jun</option> <option>Jul</option> <option>Aug</option> <option>Oct</option> <option>Sep</option> <option>Nov</option> <option>Dec</option> </select> <select class="sel-2" id="date"> <option>1</option> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> <option>6</option> <option>7</option> <option>7</option> <option>8</option> <option>9</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option> <option>24</option> <option>25</option> <option>26</option> <option>27</option> <option>28</option> <option>29</option> <option>30</option> <option>31</option> </select> </div> <div class="field"> <select class="sel-2" id="time"> <option>00</option> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> <option>07</option> <option>08</option> <option>09</option> <option>10</option> <option>11</option> <option>12</option> <option>13</option> <option>14</option> <option>15</option> <option>16</option> <option>17</option> <option>18</option> <option>19</option> <option>20</option> <option>21</option> <option>22</option> <option>23</option></select> <select class="sel-2" id="time"> <option>00</option> <option>15</option> <option>30</option> <option>45</option> </select> </div> <div class="field"> <label>No. Passangers</label> <select id="year"> <option>01</option> <option>02</option> <option>03</option> <option>04</option> <option>05</option> <option>06</option> </select> </div> </fieldset> <fieldset class="style2"> <div class="field"> <label>Pickup Information</label> <input type="text" id="where" value="Pickup Address" onblur="if(this.value==''){this.value='Pickup Address'}" onfocus="if(this.value=='Pickup Address'){this.value=''}" /> </div> <div> <select id="where"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> <fieldset class="style2 style3"> <div class="field"> <label>Drop-off Information</label> <input type="text" id="to" value="Drop-off Address" onblur="if(this.value==''){this.value='Drop-off Address'}" onfocus="if(this.value=='Drop-off Address'){this.value=''}" /> </div> <div> <select id="to"> <option>or Airport</option> <option>Stansted</option> <option>Gatwick</option> <option>Heathrow</option> <option>Luton</option> </select> </div> </fieldset> </div> </div> </div> <div class="left-bot-corner"> <div class="right-bot-corner"> <div class="border-bot"><a href="#" class="link2" onclick="document.getElementById('reserve-form').submit()"><em><b>Get Quote</b></em></a></div> </div> </div> </div> </form> //----------------------------------------------------------------------------- php script //----------------------------------------------------------------------------- <?php //--------------------------Set these paramaters-------------------------- // Subject of email sent to you. $subject = 'Results from Contact form'; // Your email address. This is where the form information will be sent. $emailadd = 'm.mcdade@hotmail.co.uk'; // Where to redirect after form is processed. $url = 'http://www.mock.thetaxirank.co.uk/thankyou.html'; // Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty. $req = '0'; // --------------------------Do not edit below this line-------------------------- $text = "Results from form:\n\n"; $space = ' '; $line = ' '; foreach ($_POST as $key => $value) { if ($req == '1') { if ($value == '') {echo "$key is empty";die;} } $j = strlen($key); if ($j >= 20) {echo "Name of form element $key cannot be longer than 20 characters";die;} $j = 20 - $j; for ($i = 1; $i <= $j; $i++) {$space .= ' ';} $value = str_replace('\n', "$line", $value); $conc = "{$key}:$space{$value}$line"; $text .= $conc; $space = ' '; } mail($emailadd, $subject, $text, 'From: '.$emailadd.''); echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; ?> //----------------------------------------------------------------------------- any advice will be appreciated..... thanks in advance to any kind souls !!! [attachment deleted by admin] Quote Link to comment Share on other sites More sharing options...
freeloader Posted August 9, 2010 Share Posted August 9, 2010 Uhm, there's a bunch of stuff wrong probably looking at this messy code. First of all, for practical reasons, next time you post something please use [ code ] tags. Also, please provide us with some more feedback. What is not working? What is the current output? Thirdly, if a script like this fails to work, try debugging the output before each step so you know which step ain't working. Anyway, looking at the most obvious thing in this script, I'm guessing at this point your mail is not arriving? Anyway, let's start with a few debug operations: at the beginning of your php script start with: print_r($_POST); exit; and post the output here. Then in a second run of the script, delete that earlier part and right before the mail( ) part, write this: echo "Debug: email ".$emailadd.", subject ".$subject.", text ".$text; exit; again, post output here. At least we'd know what part of the script is going wrong. If anybody here can see the mistake(s) directly, the debug ain't necessary of course. Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 9, 2010 Share Posted August 9, 2010 Can I get free Taxis if I help? lol only joking. Anyway try stripping to basics $subject = 'Results from Contact form'; $emailadd = 'm.mcdade@hotmail.co.uk'; $url = 'http://www.mock.thetaxirank.co.uk/thankyou.html'; $text = "This is a test"; if(mail($emailadd, $subject, $text, 'From: '.$emailadd.'')){ echo 'Mail has been sent'; }else{ echo 'there has been an error'; } Also check the SPAM box in hotmail, mail() tends to put emails into spam on hotmail Quote Link to comment Share on other sites More sharing options...
mcdade Posted August 9, 2010 Author Share Posted August 9, 2010 i do apologise bit new to this whole thing, but thanks alot for having a quick look through. after inserting [print_r($_POST); exit;] and running the script I got "Array()" after the next step i got Debug: email m.mcdade@hotmail.co.uk, subject Results from Contact form, text Results from form: i think i did what was asked ? as to the problem, you guessed right. im receiving an email, just no content . not sure if it would help to look at the form in its html state www.mock.thetaxirank.co.uk sorry and thanks for anyone's time. Quote Link to comment Share on other sites More sharing options...
onlyican Posted August 9, 2010 Share Posted August 9, 2010 Your form fields have no NAME elements <input type="text" name="frmName" id="name" value="Name" onblur="if(this.value==''){this.value='Name'}" onfocus="if(this.value=='Name'){this.value=''}" /> //Add frmName Quote Link to comment Share on other sites More sharing options...
freeloader Posted August 9, 2010 Share Posted August 9, 2010 Okay, a little explanation here. [print_r($_POST); exit;] and running the script I got "Array()" That means the post arguments didn't get passed on correctly to the php script. In fact, none of the post arguments got passed on. The reason is indeed, as the previous poster explained, because your html script has no NAME element in them. What you need to do is give every html element a clear, easy, recognizable but most importantly a unique NAME. You can't give two form inputs the same name or it will only pass on one. For example: <input type="text" id="where" name='PickupAddress' value="Pickup Address" onblur="if(this.value==''){this.value='Pickup Address'}" onfocus="if(this.value=='Pickup Address'){this.value=''}" /> after the next step i got Debug: email m.mcdade@hotmail.co.uk, subject Results from Contact form, text Results from form: It means the php script was processing everything correctly so you shouldn't get any problems there. Add names and your problem should be solved. Quote Link to comment Share on other sites More sharing options...
mcdade Posted August 9, 2010 Author Share Posted August 9, 2010 thanks guys. much appreciated ! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.