SitePoint Sponsor

User Tag List

Results 1 to 21 of 21
  1. #1
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sendmail form not working properly..probably something simple

    Can anyone help me rectify this sendmail.php form..?

    In the sendmail.php file (attached), I need to change the form id 'website' to 'pickup-addr' but everytime I try it stops the emails from going/coming altogether.


    When I leave 'website' in the sendmail.php file, it goes but this is what shows up in the body of the email:

    This message was send from:

    by: Janessa Mc Kell

    Email: janessa.mckell@gmail.com

    Pickup Details:

    Subject: airport run

    Text of message: 1 person with 4 pcs luggage

    sendmail_php.zip

  2. #2
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Sorry - but I don't normally download somebody's zip file (or full scripts for that matter). A bit of paranoia.

    Of course, you could make it easier for us to help if you JUST posted the area of code that is causing your problem

  3. #3
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ginerjm View Post
    Sorry - but I don't normally download somebody's zip file (or full scripts for that matter). A bit of paranoia.

    Of course, you could make it easier for us to help if you JUST posted the area of code that is causing your problem
    Hi ginerjm, no problem, here is the code for the two files:

    ...contacts.html

    Code:
    <div class="main">
      <div class="row-nav">
        <nav id="navigation">
          <ul style="text-align:center">
            <li><a href="home.html">about us</a></li>
            <li><a href="services.html">services</a></li>
            <li class="active"><a href="contacts.html">contact us</a></li>
          </ul>
        </nav>
        <div class="clear"></div>
        <!--/ navigation--> 
      </div>
      <section  id="content"  class="clearfix">
        <div class="box-map">
          <h2>Our Location</h2>
          
          <div class="overflow">
            <address>
            <span><strong>Call Ron Lewis at:1-868-342-6103</strong></span>
            <strong>Email:</strong><a href="mailto:wellgetuthere@gmail.com"> wellgetuthere@gmail.com</a></span>
            </address>
          </div>
        </div>
        <div class="box-form">
          <h2>Contact Form</h2>
          <div class="box error_box" style="display:none;">
            <p> Your message has not been sent successfully. There was an error on the page! </p>
          </div>
          <div class="box info_box" style="display:none;">
            <p> Thank you! Your message has been sent successfully. </p>
          </div>
          <form action="#" method="post" id="contactform">
            <fieldset>
              <div class="box-left1">
                <input type="text" name="name" id="name" placeholder="Your Name (required)" />
                <input type="text" name="email" id="email" placeholder="Your E-mail (required)" />
                <p><strong>Do you need to book us? Please give details. <br />(NB: 50% downpayment required on all drops)</strong></p>
                <input type="text" name="pickup-addr" id="pickup-addr" placeholder="Pickup Address" />
                <input type="text" name="date" id="date" placeholder="Enter Date and Time of Pickup" />
              </div>
              <div class="box-right1">
                <input type="text" name="subject" id="subject" placeholder="Subject" />
                <textarea name="message" id="message" placeholder="Send more details if you're booking us or if not, you may also send a messsage here."></textarea>
                <input id="formsend" type="submit" value="send" />
                <input type="reset" value="Clear" />
              </div>
              <div class="clear"></div>
            </fieldset>
            <fieldset>
              <div>
                <input type="hidden" value="janessa.mckell@gmail.com" id="contactemail" name="contactemail"  />
              </div>
              <div>
                <input type="hidden" value="php/sendmail.php" id="contacturl" name="contacturl"  />
              </div>
              <div class="loading"></div>
            </fieldset>
          </form>
        </div>
        <!--/ contform--> 
        
      </section>
    </div>

    ...and sendmail.php:

    Code:
    <?php
    if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'form'){
    	if (isset($_REQUEST['contactemail'])){ $mailTo = $_REQUEST['contactemail']; }
    	if (isset($_REQUEST['name'])){ $mailFromName = $_REQUEST['name']; }
    	if (isset($_REQUEST['email'])){ $mailFromEmail = $_REQUEST['email']; }
    	if (isset($_REQUEST['pickup-addr'])){ $website = $_REQUEST['pickup-addr']; }
    	if (isset($_REQUEST['date'])){ $website = $_REQUEST['date']; }
    	if (isset($_REQUEST['subject'])){ $subject = $_REQUEST['subject']; }
    	if (isset($_REQUEST['message'])){ $message = $_REQUEST['message']; }
    	if (isset($_REQUEST['mywebsite'])){ $mailFromWebsite = $_REQUEST['mywebsite']; }
    	
    	$msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $website \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    	
    	mail($mailTo, $subject, $msg, $headers);
    }
    ?>

  4. #4
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Show us the exact area that has the problem and tell us exactly what you are changing. I see no exact word 'website' in your script nor any reference in the code to a "form id". Hard to help if you don't show us the change you are making. Sorry to be such a pia, but you are not really making much sense.

  5. #5
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ginerjm View Post
    Show us the exact area that has the problem and tell us exactly what you are changing. I see no exact word 'website' in your script nor any reference in the code to a "form id". Hard to help if you don't show us the change you are making. Sorry to be such a pia, but you are not really making much sense.
    Hey ginerjm, it's okay, let me see if I can explain better...

    In the sendmail.php file, this bit of code:
    Code:
    	if (isset($_REQUEST['contactemail'])){ $mailTo = $_REQUEST['contactemail']; }
    	if (isset($_REQUEST['name'])){ $mailFromName = $_REQUEST['name']; }
    	if (isset($_REQUEST['email'])){ $mailFromEmail = $_REQUEST['email']; }
    	if (isset($_REQUEST['pickup-addr'])){ $website = $_REQUEST['pickup-addr']; }
    	if (isset($_REQUEST['date'])){ $website = $_REQUEST['date']; }
    	if (isset($_REQUEST['subject'])){ $subject = $_REQUEST['subject']; }
    	if (isset($_REQUEST['message'])){ $message = $_REQUEST['message']; }
    	if (isset($_REQUEST['mywebsite'])){ $mailFromWebsite = $_REQUEST['mywebsite']; }
    corresponds to the output (the email that is sent when the form is filled out)...

    This message was send from:

    by: Janessa Mc Kell

    Email: janessa.mckell@gmail.com

    Pickup Details:

    Subject: airport run

    Text of message: 1 person with 4 pcs luggage

    ----

    You'd notice that 'Pickup Details' is blank but I have tried assigning that field's id (pickup-addr) to be displayed after the words 'Pickup Details'...but it's not responding that way...The code that is controlling the Display (when the form is emailed):

    Code:
    $msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $website \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    It's just leaving it out altogether, even when I change 'website' as the field id to 'pickup-addr' - see these two lines:

    Code:
    	if (isset($_REQUEST['pickup-addr'])){ $website = $_REQUEST['pickup-addr']; }
    	if (isset($_REQUEST['date'])){ $website = $_REQUEST['date']; }
    I really hope this explanation is better...

  6. #6
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    See where you are storing the date input.

  7. #7
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What's that ginerjm?

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Look at your code! Where are you storing the date value from your post array?

  9. #9
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This message was send from:

    by: Janessa Mc Kell

    Email: janessa.mckell@gmail.com

    Pickup Details:

    Subject: airport run

    Text of message: 1 person with 4 pcs luggage

    ----

    You'd notice that 'Pickup Details' is blank but I have tried assigning that field's id (pickup-addr) to be displayed after the words 'Pickup Details'...but it's not responding that way...The code that is controlling the Display (when the form is emailed):
    Code:
    $msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $website \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    It's just leaving it out altogether, even when I change 'website' as the field id to 'pickup-addr' - see these two lines:
    Code:
    	if (isset($_REQUEST['pickup-addr'])){ $website = $_REQUEST['pickup-addr']; }
    	if (isset($_REQUEST['date'])){ $website = $_REQUEST['date']; }
    Your supposed "output" display was NOT generated by the code you have provided. Makes me wonder what code you are running.
    Also - what is this "field id" you are referring to? Also - you apparently are NOT entering any data into the 'date' field since your pickup addr should be showing a date value since that is where you are stashing the date value. Huge typo.

  10. #10
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,590
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    $website is being assigned the value of 'pickup-addr', but then in the next line it's being assigned to 'date', which is a mistake. If you don't need to collect the date (and you aren't sending it to the email anyway) then just delete the date input and also this line:

    Code:
    if (isset($_REQUEST['date'])){ $website = $_REQUEST['date']; }
    But either way, don't use $website twice. Change it to something meaningful, like so:

    Code:
    if (isset($_REQUEST['pickup-addr'])){ $address = $_REQUEST['pickup-addr']; }
    if (isset($_REQUEST['date'])){ $pickupdate = $_REQUEST['date']; }
    Then output these to email something like this:

    Code:
    $msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $address \n\n Date: $pickupdate \n\nSubject: $subject \n\nText of message: $message";

  11. #11
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    ....Then output these to email something like this:

    Code:
    $msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $address \n\n Date: $pickupdate \n\nSubject: $subject \n\nText of message: $message";
    Hey guys..

    ralph.m, I'd tried that...There is still no output next to 'Pickup Details' and 'Date'...tsk, a little old form giving so much trouble...

    The form code in contacts.html is now:

    Code:
        <div class="box-form">
          <h2>Contact Form</h2>
          <div class="box error_box" style="display:none;">
            <p> Your message has not been sent successfully. There was an error on the page! </p>
          </div>
          <div class="box info_box" style="display:none;">
            <p> Thank you! Your message has been sent successfully. </p>
          </div>
          <form action="#" method="post" id="contactform">
            <fieldset>
              <div class="box-left1">
                <input type="text" name="name" id="name" placeholder="Your Name (required)" />
                <input type="text" name="email" id="email" placeholder="Your E-mail (required)" />
                <p><strong>Do you need to book us? Please give details. <br />(NB: 50% downpayment required on all drops)</strong></p>
                <input type="text" name="address" id="address" placeholder="Pickup Address" />
                <input type="text" name="pickupdate" id="pickupdate" placeholder="Enter Date and Time of Pickup" />
              </div>
              <div class="box-right1">
                <input type="text" name="subject" id="subject" placeholder="Subject" />
                <textarea name="message" id="message" placeholder="Send more details if you're booking us or if not, you may also send a messsage here."></textarea>
                <input id="formsend" type="submit" value="send" />
                <input type="reset" value="Clear" />
              </div>
              <div class="clear"></div>
            </fieldset>
            <fieldset>
              <div>
                <input type="hidden" value="janessa.mckell@gmail.com" id="contactemail" name="contactemail"  />
              </div>
              <div>
                <input type="hidden" value="php/sendmail.php" id="contacturl" name="contacturl"  />
              </div>
              <div class="loading"></div>
            </fieldset>
          </form>
        </div>
        <!--/ contform-->
    and the code in sendmail.php is now:

    Code:
    <?php
    if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'form'){
    	if (isset($_REQUEST['contactemail'])){ $mailTo = $_REQUEST['contactemail']; }
    	if (isset($_REQUEST['name'])){ $mailFromName = $_REQUEST['name']; }
    	if (isset($_REQUEST['email'])){ $mailFromEmail = $_REQUEST['email']; }
    	if (isset($_REQUEST['pickup-addr'])){ $address = $_REQUEST['pickup-addr']; } 
    	if (isset($_REQUEST['date'])){ $pickupdate = $_REQUEST['date']; }
    	if (isset($_REQUEST['subject'])){ $subject = $_REQUEST['subject']; }
    	if (isset($_REQUEST['message'])){ $message = $_REQUEST['message']; }
    	if (isset($_REQUEST['mywebsite'])){ $mailFromWebsite = $_REQUEST['mywebsite']; }
    	
    	$msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $address \n\nDate: $pickupdate \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    	
    	mail($mailTo, $subject, $msg, $headers);
    }
    ?>

    Still nothing outputting from '$address' and 'pickupdate'...

    ginerjm, I realise there is some funny business going on with this site, as in the changes are being made to the php but then, nothing...It's a simple micro-site and the sitemap is as such:

    getuthere {
    about.html
    home.html
    index.html
    services.html
    contacts.html
    (images - folder)
    (css - folder -->
    jquery.jscrollpane.css
    style.css
    nivo-slider.css
    prettyPhoto.css)
    (js - folder -->
    jquery-1.7.min.js
    jquery.mousewheel.js
    jquery.jscrollpane.js
    js/jquery.cycle.all.min.js
    jquery.easing.1.3.js
    js/jquery.tweet.js
    ==jquery.prettyPhoto.js"></script>
    (php - folder --> sendmail.php)


    }


    So, in the site itself, I'm not seeing any other php or js file that could be conflicting with what is being output from the form...

  12. #12
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,590
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by greenink View Post
    There is still no output next to 'Pickup Details' and 'Date'
    You've made a major mistake, though. The PHP identifies the input fields by the 'name' attribute. (The id is irrelevant to the PHP. That's really for styling and for associating a label with the input.)

    In the HTML you have name="address" and name="pickupdate", but in the PHP you have $_REQUEST['pickup-addr'] and $_REQUEST['date']

    The PHP would need to be $_REQUEST['address'] and $_REQUEST['pickupdate']

  13. #13
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You've made a major mistake, though. The PHP identifies the input fields by the 'name' attribute. (The id is irrelevant to the PHP. That's really for styling and for associating a label with the input.)

    In the HTML you have name="address" and name="pickupdate", but in the PHP you have $_REQUEST['pickup-addr'] and $_REQUEST['date']

    The PHP would need to be $_REQUEST['address'] and $_REQUEST['pickupdate']
    Now guys, I don't want you to think that I'm just this crazy person who has no idea what they're doing and I'm giving you a bunch of worries here over just my silly mistakes..

    The thing is that although that error was there, even when I have all the right values, because I've been finagling with this for about two whole weeks before I came on the forum...even when all the right values are there, the form is still not sending 'Pickup Details' and 'Date', so even in the beginning when I left 'website' in the both places, it's not that I was expecting that code to work but I left it as is to put it up in the forum here to show the complete process of this thing and was explaining that when I switch out $website for the actual fields used in the contacts.html file, the form is still not sending the 'Pickup Details' and 'Date'. And it's been doing that since like forever...

    I really appreciate the assistance, please don't get frustrated with me or this. Currently the form is still coming to me in the email like this:

    This message was sent from:

    by: Janessa Mc Kell

    Email: janessa.mckell@gmail.com

    Pickup Details:

    Date:

    Subject: Airport Run

    Text of message: 4pcs luggage and 1 person



    As it is, the code in sendmail.php is as such:

    Code:
    <?php
    if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'form'){
    	if (isset($_REQUEST['contactemail'])){ $mailTo = $_REQUEST['contactemail']; }
    	if (isset($_REQUEST['name'])){ $mailFromName = $_REQUEST['name']; }
    	if (isset($_REQUEST['email'])){ $mailFromEmail = $_REQUEST['email']; }
    	if (isset($_REQUEST['address'])){ $address = $_REQUEST['address']; } 
    	if (isset($_REQUEST['pickupdate'])){ $pickupdate = $_REQUEST['pickupdate']; }
    	if (isset($_REQUEST['subject'])){ $subject = $_REQUEST['subject']; }
    	if (isset($_REQUEST['message'])){ $message = $_REQUEST['message']; }
    	if (isset($_REQUEST['mywebsite'])){ $mailFromWebsite = $_REQUEST['mywebsite']; }
    	
    	$msg = "This message was sent from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nPickup Details: $address \n\nDate: $pickupdate \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    	
    	mail($mailTo, $subject, $msg, $headers);
    }
    ?>
    ...and the form code in contacts.html is now:

    Code:
    <div class="box-form">
          <h2>Contact Form</h2>
          <div class="box error_box" style="display:none;">
            <p> Your message has not been sent successfully. There was an error on the page! </p>
          </div>
          <div class="box info_box" style="display:none;">
            <p> Thank you! Your message has been sent successfully. </p>
          </div>
          <form action="#" method="post" id="contactform">
            <fieldset>
              <div class="box-left1">
                <input type="text" name="name" id="name" placeholder="Your Name (required)" />
                <input type="text" name="email" id="email" placeholder="Your E-mail (required)" />
                <p><strong>Do you need to book us? Please give details. <br />(NB: 50% downpayment required on all drops)</strong></p>
                <input type="text" name="address" id="address" placeholder="Pickup Address" />
                <input type="text" name="pickupdate" id="pickupdate" placeholder="Enter Date and Time of Pickup" />
              </div>
              <div class="box-right1">
                <input type="text" name="subject" id="subject" placeholder="Subject" />
                <textarea name="message" id="message" placeholder="Send more details if you're booking us or if not, you may also send a messsage here."></textarea>
                <input id="formsend" type="submit" value="send" />
                <input type="reset" value="Clear" />
              </div>
              <div class="clear"></div>
            </fieldset>
            <fieldset>
              <div>
                <input type="hidden" value="janessa.mckell@gmail.com" id="contactemail" name="contactemail"  />
              </div>
              <div>
                <input type="hidden" value="php/sendmail.php" id="contacturl" name="contacturl"  />
              </div>
              <div class="loading"></div>
            </fieldset>
          </form>
        </div>
        <!--/ contform-->

    Now this is a micro-site that I'm just customising, so what it was out of the box was this:

    sendmail.php
    Code:
    <?php
    if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'form'){
    	if (isset($_REQUEST['contactemail'])){ $mailTo = $_REQUEST['contactemail']; }
    	if (isset($_REQUEST['name'])){ $mailFromName = $_REQUEST['name']; }
    	if (isset($_REQUEST['email'])){ $mailFromEmail = $_REQUEST['email']; }
    	if (isset($_REQUEST['website'])){ $website = $_REQUEST['website']; } else { $website = 'unknown'; }
    	if (isset($_REQUEST['subject'])){ $subject = $_REQUEST['subject']; }
    	if (isset($_REQUEST['message'])){ $message = $_REQUEST['message']; }
    	if (isset($_REQUEST['mywebsite'])){ $mailFromWebsite = $_REQUEST['mywebsite']; }
    	
    	$msg = "This message was send from: $mailFromWebsite \n\nby: $mailFromName \n\nEmail: $mailFromEmail \n\nWebsite: $website \n\nSubject: $subject \n\nText of message: $message";
    	$headers = "MIME-Version: 1.0\r\n Content-type: text/html; charset=utf-8\r\n From: $mailFromEmail\r\n Reply-To: $mailFromEmail";
    	
    	mail($mailTo, $subject, $msg, $headers);
    }
    ?>

    ..and the form code in contacts.html:

    Code:
    <div class="box-form">
          <h2>Contact Form</h2>
          <div class="box error_box" style="display:none;">
            <p> Your message has not been sent successfully. It was an error on page! </p>
          </div>
          <div class="box info_box" style="display:none;">
            <p> Thank you! Your message has been sent successfully. </p>
          </div>
          <form action="#" method="post" id="contactform">
            <fieldset>
              <div class="box-left1">
                <input type="text" name="name" id="name" placeholder="Your Name (required)" />
                <input type="text" name="email" id="email" placeholder="Your E-mail (required)" />
                <input type="text" name="url" id="url" placeholder="Your Website:" />
                <input type="text" name="subject" id="subject" placeholder="Subject" />
              </div>
              <div class="box-right1">
                <textarea name="message" id="message" placeholder="Message"></textarea>
                <input id="formsend" type="submit" value="send" />
                <input type="reset" value="Clear" />
              </div>
              <div class="clear"></div>
            </fieldset>
            <fieldset>
              <div>
                <input type="hidden" value="your@mail.com" id="contactemail" name="contactemail"  />
              </div>
              <div>
                <input type="hidden" value="php/sendmail.php" id="contacturl" name="contacturl"  />
              </div>
              <div class="loading"></div>
            </fieldset>
          </form>
        </div>
        <!--/ contform-->

    ..so what we've been discussing is my edited bit of code..I'm putting the previous code so that perhaps it may clue us in as to why the edited code is not working...?!

    Hopeful...

  14. #14
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,590
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Presumably that original code didn't work either? Because it has $_REQUEST['website'] in the PHP while, in the HTML, it says name="url", which doesn't match.

  15. #15
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Did I miss something here?

    I don't like this code either. You are NOT showing us what you are executing.

    Reason: Your first line of php looks for an input named 'type'. This field is not defined in your html code. Period. I could almost think you were trying to determine the "type of request' but I give up on that idea when you test for a value of 'form'. What is that?

    Anyway, the failure to get a true response for that above line causes you NOT to obtain any of the values you seem to be getting. So - the output you are showing us as your supposed result is being manufactured by you OR BEING GENERATED BY SOME OTHER CHUNK OF CODE.

    I get really frustrated by posters who give us one thing while doing something else and then ask us to not get that way. Sheesh!

  16. #16
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Presumably that original code didn't work either? Because it has $_REQUEST['website'] in the PHP while, in the HTML, it says name="url", which doesn't match.
    Hey ralph.m, I'm going to try the site in it's original form and see if the form works...

    Hmm, actually, the original code isn't working - I inserted my email address in this line (see below- somewhere around line 54) of the original, uploaded it to my server and nothing:
    Code:
    <input type="hidden" value="janessa.mckell@gmail.com" id="contactemail" name="contactemail"  />
    You can see the original site here:
    http://wellgetuthere.com/getuthere-test/

    and this is my edited site:
    http://wellgetuthere.com/getuthere/

    Hey ginerjm, there isn't anything else in the site that's running...this is all the form code here that I've sent...

    I sent the sitemap - it's a small micro-site:

    getuthere {
    about.html
    home.html
    index.html
    services.html
    contacts.html
    (images - folder)
    (css - folder -->
    jquery.jscrollpane.css
    style.css
    nivo-slider.css
    prettyPhoto.css)
    (js - folder -->
    jquery-1.7.min.js
    jquery.mousewheel.js
    jquery.jscrollpane.js
    js/jquery.cycle.all.min.js
    jquery.easing.1.3.js
    js/jquery.tweet.js
    ==jquery.prettyPhoto.js"></script>
    (php - folder --> sendmail.php)

    }

  17. #17
    SitePoint Enthusiast
    Join Date
    Jul 2013
    Location
    Voorheesville NY USA
    Posts
    88
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't buy it. You're not giving us the whole picture. Your html code is being included in some other script (you're not showing us) and the points I made have to be explained by that other script. Do some research on this stuff and come up with an answer.

    I am NOT going to dig into all your other pieces of code. Authors do that.

    Good luck.

  18. #18
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ginerjm View Post
    I don't buy it. You're not giving us the whole picture. Your html code is being included in some other script (you're not showing us) and the points I made have to be explained by that other script. Do some research on this stuff and come up with an answer.

    I am NOT going to dig into all your other pieces of code. Authors do that.

    Good luck.
    No problem ginerjm

  19. #19
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,590
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Quote Originally Posted by greenink View Post
    You can see the original site here
    I think at this point I'd recommend you dump this form script you are using and try another one, as there is something too weird going on. But before that, I have a stronger recommendation. All of the content on your site is served up by JavaScript, which is totally unnecessary, and a very bad idea. With JS off, there's no content on your site. That may not bother you, but there are other consequences to this, such as there being no content on your site for Google to index. So really, I would advise you to start from scratch here—build the site with HTML and CSS (no JS) and then use a nice, clean form script that is straightforward and secure.

  20. #20
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    I think at this point I'd recommend you dump this form script you are using and try another one, as there is something too weird going on. But before that, I have a stronger recommendation. All of the content on your site is served up by JavaScript, which is totally unnecessary, and a very bad idea. With JS off, there's no content on your site. That may not bother you, but there are other consequences to this, such as there being no content on your site for Google to index. So really, I would advise you to start from scratch here—build the site with HTML and CSS (no JS) and then use a nice, clean form script that is straightforward and secure.
    Okay, :-) thanks very much Ralph..

  21. #21
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I know this is a done deal, and ginerjm thought I knew and was holding back, but I honestly didn't realise that Javascript was impacting the form. When you said ralph.m that 'All of the content on the site is served up by Javascript', I decided to check the 'js' folder and I found some code that looks like it relates to the form in the 'custom.js' file.

    I just wanted to let you guys know that, and thank you again for your diligence and patience. :-)

    See below (custom.js)

    "function loadPage(url){
    if (url){
    if (!$('#content').html()){
    $('#content').hide().load(url, function(){
    $('<span id="body_loader"/>').appendTo('#container').animate({left: 0}, 400);
    $('#dcontent').fadeOut('slow', function(){
    $('#body_loader').fadeOut('fast', function() {
    $(this).remove();
    });
    $('#content').fadeIn('normal');
    $('#dcontent').html('');
    initLinks();
    initJS(url);
    });
    });
    } else {
    $('#dcontent').hide().load(url, function(){
    $('<span id="body_loader"/>').appendTo('#container').animate({left: 0}, 400);
    $('#content').fadeOut('slow', function(){
    $('#body_loader').fadeOut('fast', function() {
    $(this).remove();
    });
    $('#dcontent').fadeIn('normal');
    $('#content').html('');
    initLinks();
    initJS(url);
    });
    });
    }
    }
    }

    function initJS(url){
    switch (url){
    case 'home.html':
    $('#navigation ul > li').hover(
    function() {$('ul', this).stop(true,true).slideDown(300);},
    function() {$('ul', this).stop(true,true).slideUp(300);}
    )
    if($('#cycle').length) {
    $('#cycle').cycle({
    easing: 'easeOutQuint',
    fx: 'scrollHorz',
    next: '#next_slide',
    prev: '#prev_slide',
    animation:700,
    pager: false,
    timeout:5500
    });
    }


    break;
    case 'about.html':
    $('#navigation ul > li').hover(
    function() {$('ul', this).stop(true,true).slideDown(300);},
    function() {$('ul', this).stop(true,true).slideUp(300);}
    )
    if($('#slider').length) {
    $('#slider').nivoSlider({directionNav: false, pauseTime:5000, captionOpacity: 1,effect: 'fade',});
    }



    $('.scroll-pane').jScrollPane({showArrows: true});

    break;
    case 'collection.html':
    $('#navigation ul > li').hover(
    function() {$('ul', this).stop(true,true).slideDown(300);},
    function() {$('ul', this).stop(true,true).slideUp(300);}
    )

    $('.carousel').uCarausel({show:5,buttonClass:'car-button'
    ,duration:800,
    easing:'easeOutQuint'})

    $('.carousel1').uCarausel({show:5,buttonClass:'car-button1'
    ,duration:800,
    easing:'easeOutQuint'})


    $('.lightbox-image').prettyPhoto({theme:'light_square',autoplay_slideshow:false,autoplay:false,social_tools:false,animation_speed:'normal'})



    break;
    case 'news.html':
    $('#navigation ul > li').hover(
    function() {$('ul', this).stop(true,true).slideDown(300);},
    function() {$('ul', this).stop(true,true).slideUp(300);}
    )
    $('.scroll-pane').jScrollPane({showArrows: true});

    break;
    case 'contacts.html':
    $('#navigation ul > li').hover(
    function() {$('ul', this).stop(true,true).slideDown(300);},
    function() {$('ul', this).stop(true,true).slideUp(300);})

    /* Contact Form */
    function checkemail(emailaddress){
    var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
    return pattern.test(emailaddress);
    }

    jQuery('#contactform #formsend').click(function(){
    var $name = jQuery('#name').val();
    var $email = jQuery('#email').val();
    var $subject = jQuery('#subject').val();
    var $url = jQuery('#url').val();
    var $message = jQuery('#message').val();
    var $contactemail = jQuery('#contactemail').val();
    var $contacturl = jQuery('#contacturl').val();
    var $mywebsite = jQuery('#contactwebsite').val();

    if ($name != '' && $name.length < 3){ $nameshort = true; } else { $nameshort = false; }
    if ($name != '' && $name.length > 30){ $namelong = true; } else { $namelong = false; }
    if ($email != '' && checkemail($email)){ $emailerror = true; } else { $emailerror = false; }
    if ($subject != '' && $subject.length < 3){ $subjectshort = true; } else { $subjectshort = false; }
    if ($subject != '' && $subject.length > 100){ $subjectlong = true; } else { $subjectlong = false; }
    if ($url == ''){ $url = 'none'; }
    if ($message != '' && $message.length < 3){ $messageshort = true; } else { $messageshort = false; }

    jQuery('#contactform .loading').animate({opacity: 1}, 250);

    if ($name != '' && $nameshort != true && $namelong != true && $email != '' && $emailerror != false && $subject != '' && $subjectshort != true && $subjectlong != true && $message != '' && $messageshort != true && $contactemail != '' && $contacturl != '' && $mywebsite != ''){
    jQuery.post($contacturl,
    {type: 'form', contactemail: $contactemail, name: $name, email: $email, subject: $subject, website: $url, message: $message, mywebsite: $mywebsite},
    function(data){
    jQuery('#contactform .loading').animate({opacity: 0}, 250);
    jQuery('div.contform').fadeOut('slow');
    jQuery('#name, #subject, #url, #email, #message').val('');
    jQuery('#contactform div.form_info div.form_error').hide();
    jQuery('.box').hide();
    jQuery('.info_box').fadeIn('fast');
    jQuery('html, body').animate({scrollTop:250}, 'slow');
    jQuery('.info_box').delay(5000).fadeOut(1000, function(){
    jQuery('div.contform').fadeIn('slow');
    });
    }
    );

    return false;
    } else {
    jQuery('#contactform .loading').animate({opacity: 0}, 250);
    jQuery('.box').hide();
    jQuery('.error_box').fadeIn('fast');
    jQuery('html, body').animate({scrollTop:250}, 'slow');
    jQuery('.error_box').delay(5000).fadeOut('slow');

    if ($name == ''){
    jQuery('#name').parent().parent().parent().find('div.form_error').hide();
    jQuery('#name').parent().parent().parent().find('div.defaulterror').show();
    } else if ($nameshort == true){
    jQuery('#name').parent().parent().parent().find('div.form_error').hide();
    jQuery('#name').parent().parent().parent().find('div.shorterror').show();
    } else if ($namelong == true){
    jQuery('#name').parent().parent().parent().find('div.form_error').hide();
    jQuery('#name').parent().parent().parent().find('div.longerror').show();
    } else {
    jQuery('#name').parent().parent().parent().find('div.form_error').hide();
    }

    if ($email == ''){
    jQuery('#email').parent().parent().parent().find('div.form_error').hide();
    jQuery('#email').parent().parent().parent().find('div.defaulterror').show();
    } else if ($emailerror == false){
    jQuery('#email').parent().parent().parent().find('div.form_error').hide();
    jQuery('#email').parent().parent().parent().find('div.invaliderror').show();
    } else {
    jQuery('#email').parent().parent().parent().find('div.form_error').hide();
    }

    if ($subject == ''){
    jQuery('#subject').parent().parent().parent().find('div.form_error').hide();
    jQuery('#subject').parent().parent().parent().find('div.defaulterror').show();
    } else if ($subjectshort == true){
    jQuery('#subject').parent().parent().parent().find('div.form_error').hide();
    jQuery('#subject').parent().parent().parent().find('div.shorterror').show();
    } else if ($subjectlong == true){
    jQuery('#subject').parent().parent().parent().find('div.form_error').hide();
    jQuery('#subject').parent().parent().parent().find('div.longerror').show();
    } else {
    jQuery('#subject').parent().parent().parent().find('div.form_error').hide();
    }

    if ($message == ''){
    jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide();
    jQuery('#message').parent().parent().parent().parent().parent().find('div.defaulterror').show();
    } else if ($messageshort == true){
    jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide();
    jQuery('#message').parent().parent().parent().parent().parent().find('div.shorterror').show();
    } else {
    jQuery('#message').parent().parent().parent().parent().parent().find('div.form_error').hide();
    }

    return false;
    }
    });
    break;
    }
    }

    function initLinks(){
    $('#navigation ul a, .logo a').click(function(){

    loadPage($(this).attr('href'));
    return false;
    });
    }

    /********************************* DOM Ready ************************************/

    $(function(){
    loadPage('home.html');
    });


    /********************************* DOM End ************************************/ "


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •