Auto Scroll

I need my web page to auto scroll to the bottom of the page when the user submits the form. This is what I have added to accomplish that.

  1. header(‘Location: script.php#bottomOfPage’);
  2. <a name=“bottomOfPage”></a>

My question is, where do I place #1?

This is my form:


        <!--START FORM-->
	
		<?php

           include('inc/config.inc');
           include('inc/header.php');

            // Read in options

            //	$ax_reCaptcha		= false;

            //	$px_recaptcha_challenge_field = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
            //	$px_recaptcha_response_field  = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';

                $nameError      = "";
                $emailError     = "";
                $phoneNumberError     = "";
                $commentError   = "";
				$sourceError   = "";
            //	$recaptchaError = "";

            // See if we're using reCaptcha
            //	if (isset($ax_publicKey) && $ax_publicKey != '' &&	isset($ax_privateKey) && $ax_privateKey != '') {
            //		$ax_reCaptcha = true;
            //		require_once('libs/recaptcha.php');
            //		$resp = recaptcha_check_answer ($ax_privateKey, $_SERVER['REMOTE_ADDR'], $px_recaptcha_challenge_field, $px_recaptcha_response_field);
            //	}

            // See if form was submitted
                if (isset($_POST['axMail'])) {

                    // Validate Name
                        $contactName = filter_input(INPUT_POST, 'contactName', FILTER_SANITIZE_STRING);
                        if ($contactName == '') {
                            $nameError = 'Please enter a valid name.';
                            $hasError = true;	
                        }

                    // Validate Email
                        $email = filter_input( INPUT_POST, 'email', FILTER_SANITIZE_EMAIL );
                    //	if (!filter_var( $email, FILTER_VALIDATE_EMAIL )) {
                    //		$emailError = '' . $email . ' is <strong>NOT</strong> a valid email address.';
                    //		$hasError = true;	
                    //	}

                    // Validate Phone
                        $phoneNumber = filter_input(INPUT_POST, 'phoneNumber', FILTER_SANITIZE_STRING);

                    //	if ($phoneNumber == '' || empty($phoneNumber)) {
                    //		$phoneNumberError = 'Please enter a valid phone number.';
                    //		$hasError = true;
                    //	}

                    // Validate Message
                        $message = filter_input( INPUT_POST, 'message', FILTER_SANITIZE_STRING); 	
                    //	if ($message == '') {
                    //		$commentError = 'Please enter a message to send.<br/>';
                    //		$hasError = true;	
                    //	}
					
					// Validate Address
                        $source = filter_input(INPUT_POST, 'source', FILTER_SANITIZE_STRING);
                    //	if ($address == '') {
                    //		$addressError = 'Please enter a valid address.';
                    //		$hasError = true;	
                    //	}

                    // Validate reCaptcha
                    //	if ($ax_reCaptcha && !$resp->is_valid) {
                    //		$recaptchaError = 'The reCAPTCHA wasn\\'t entered correctly. Please try again.';
                    //		$hasError = true;
                    //	}

                 // Capture Send To Email Addy
                       $ax_mailTo = filter_input( INPUT_POST, 'emailTo', FILTER_SANITIZE_EMAIL);
                        if (!filter_var( $ax_mailTo, FILTER_VALIDATE_EMAIL )) {
                            $emailError = '' . $ax_mailTo . ' is <strong>NOT</strong> a valid email address.';
                            $hasError = true;	
                        }

                    // If we didn't hit an error, send the email
                        if (!isset($hasError)) {

                            // Body:
    $body = '
    Name: ' . $contactName . '
    Email: ' . $email . '
    Phone: ' . $phoneNumber . '
    Message: ' . $message . '
	Source: ' . $source . '	
    ';

                            // Headers
                                $headers = 'From: ' . $email . "\\r\
" .
                                           'Reply-To: ' . $email . "\\r\
";

                            // Send it
                                @ini_set('sendmail_from', $email);		
                                mail($ax_mailTo, $ax_mailSubject . ' : ' . $subject , $body, $headers);
                                $emailSent = true;
                        }

                }

            // Output template
                echo '<div class="ax-outer">';
                if (isset($emailSent) && $emailSent == true) { 					
                    echo '
                        <h1>Thanks, ' . $contactName . '</h1>
                        <p>' . $finishedtext . '</p>
                    ';
                } else {			
                ?>

                        <?php /*?><?php if ($ax_reCaptcha) { ?>

                            <script type="text/javascript">
                                var RecaptchaOptions = {
                                    theme : '<?php echo $ax_recaptchaTheme; ?>'
                                };
                            </script>

                        <?php } ?><?php */?>

                        <form action="index.php" id="ax-contactForm" method="post">

                            <?php if ($nameError != '') { ?>
                                <p class="error"><?php echo $nameError; ?></p>
                            <?php } ?>
                            <input type="text" name="contactName" id="contactName" title="name" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" value="Full Name<?php if (isset($contactName)) echo $contactName;?>" class="requiredField ax-input" />

                            <?php if ($emailError != '') { ?>
                                <p class="error"><?php echo $emailError; ?></p>
                            <?php } ?>
                            <input type="text" name="email" id="email" title="email" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" value="Email<?php if (isset($email))  echo $email;?>" class="requiredField email ax-input" />

                            <?php if ($phoneNumber == '') { ?>
                                <p class="error"><?php echo $phoneNumberError; ?></p>
                            <?php } ?>
                            <input type="text" name="phoneNumber" id="phoneNumber" title="number" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" value="Phone #<?php if (isset($phoneNumber)) echo $phoneNumber;?>" class="ax-input" />

                            <?php if ($commentError != '') { ?>
                                <p class="error"><?php echo $commentError; ?></p>
                            <?php } ?>
                            <textarea name="message" id="message" title="message" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" rows="20" cols="30" class="requiredField ax-textarea">Message<?php if (isset($message)) { if (function_exists('stripslashes')) { echo stripslashes($message); } else { echo $message; } } ?></textarea>

                            <?php if ($source == '') { ?>
                                <p class="error"><?php echo $sourceError; ?></p>
                            <?php } ?>
                            <select type="text" name="source" id="source" title="source" class="requiredField ax-input" />
                                  <option value="">How did you find us?</option>
                                  <?php
                                  $choices = array('Internet','Word of Mouth','Sign','Truck','Yellowpages','Other');
                                     foreach($choices as $choice){
                                        if(isset($source) && $source ==str_replace(' ', '_', strtolower($choice)) ){
                                          $selected = 'selected="selected"';
                                        }
                                        echo "<option ".$selected." value='".str_replace(' ', '_', strtolower($choice))."'>".$choice."</option>";
                                     }
                                  ?>

                            </select>

                            <div style="display:none;">
                            <label for="emailTo" class="ax-label">Send To</label>
                            <select id="emailTo" name='emailTo' class="requiredField ax-select">
                                <?php
                                    for($i=0; $i < count($adminemail); $i++) {
                                        foreach($adminemail[$i] as $key => $val) {
                                            echo '<option value="'.$key.'">'.$val.'</option>';
                                        }
                                    }
                                ?>
                            </select>
                            </div>

                            <?php /*?>
                            <?php if ($ax_reCaptcha) { ?>
                                <?php if ($recaptchaError != '') { ?>
                                    <p class="error"><?php echo $recaptchaError ; ?></p>
                                <?php } ?>

                                    <script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=<?php echo $ax_publicKey; ?>"></script>
                                    <noscript>
                                        <iframe src="http://www.google.com/recaptcha/api/noscript?k=<?php echo $ax_publicKey; ?>" height="300" width="300" frameborder="0"></iframe><br />
                                        <textarea name="recaptcha_challenge_field" rows="3" cols="40"> </textarea>
                                        <input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
                                    </noscript>

                            <?php } ?>
                            <?php */?>

                            <input type="hidden" name="axMail" id="axMail" value="true" />
                            <p><button type="submit" class="ax-button">Send Message</button></p>	

                        </form>

                <?php

                }

                echo '</div>';

            include('inc/footer.php');
        ?>

Thanks!:slight_smile:

-Sam

Right after the email is validated and sent.

mail($ax_mailTo, $ax_mailSubject . ’ : ’ . $subject , $body, $headers);
header(‘Location: script.php#bottomOfPage’);
exit;

Note that there must not be any outputs when header is called; otherwise the program will terminated with errors.

Thanks for the advice! As I am very new to php and still learning, I’m not sure what I need to do. I tried adding this snippet of code where you specified, but it gave me an error: Warning: Cannot modify header information - headers already sent

I don’t want to use up too much of your time with my newbie questions. So any advice is appreciated!

Thanks again, Sam

Either config.inc or header.php or both output some content before returning to script.php thus the error message that you got. If you can post the codes of those two scripts, perhaps I can suggest the changes needed.

You can use the script below and see how this works:

<?php

   $email = $_POST['email'];
   $message = $_POST['message'];
   if ($email && $message)
   {
	   $to = 'youremail@yoursite.com'; // your email address, can be @gmail.com, etc.
	   $subject = 'Contact from yoursite.com'; // change yoursite.com to your own domain name
	   $message .= "\\r\
\\r\
";
	   $headers = 'From: '.$_POST['email']."\\r\
".
		      'Reply-To: '.$_POST['email']."\\r\
";
	   mail($to, $subject, $message, $headers);

	   header('Location: script.php#bottomOfPage');
	   exit;

   }
   else
   {
	   echo '
<html>
<head>
<title>Testing...</title>
</head>
<body>
<h3>Enter your email and message:</h3>
<form action="script.php" method="post">
<p>
   Your Email: <input type="text" name="email" value="'.$email.'" size="40"/>
</p>
<p>
   Your Message: <br/>
   <textarea type="text" name="message" rows="10" cols="40">'.$message.'</textarea>
</p>
<p><button type="submit" name="submit">Send</button></p>
</form>';
   }
   echo '
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<p>Lorem ipsum dolor sit amet, consectetuer sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua. At vero eos et accusam
et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
Lorem ipsum dolor sit amet, consetetur sadipscing elitr,
sed diam nonumy eirmod tempor invidunt ut labore et dolore
magna aliquyam erat, sed diam voluptua.</p>
<a name="bottomOfPage"></a>
</body>
</html>';
?>

These are the files:

header.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title></title>
	<meta name="description" content="" />
	<meta name="keywords" content="" />
	
	<link rel="stylesheet" type="text/css" href="style.css" />
	
</head>

<body>

</body>
</html>

config.inc

<?php

# Specify text to prepend to the subject filled out in the contact form
$ax_mailSubject  	 = "mysite.com - New Message";

# If you do not have a reCAPTCHA API Key - visit the following URL to signup
# http://www.google.com/recaptcha/whyrecaptcha
# If the following are left blank, this feature will simply be ignored

$ax_publicKey		 = "12456";
$ax_privateKey		 = "12345";
$ax_recaptchaTheme = "clean"; // valid values = red, white, blackglass, clean

# variables below corresponds to the Send to * in your contact form
# follow same formatting below to add new entries to the select box

$adminemail[] = array("name@mysite.com" => "Customer Service");

# text to display when form is submitted
$finishedtext = "Your email was successfully sent. We will be in touch soon.";

# reCAPTCHA Variables - do not modify unless these change
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
?>

Perhaps it is a common practice to embed PHP tags (I counted 38) in a document but they are very difficult to debug so the first thing I did was removed all of them except one, which is the first one. Also in your case, there should not be any output before the header is called so there should not be anything above <?php; otherwise you will get the message you got.

I also inserted the config.inc at the beginning of the script so that we can insure there will be no output generated from that file.

onblur and onfocus are not working as you intended. If I have time, I will look them over. My knowledge of JavaScript is weak so maybe other members here can help out.

<?php
// Specify text to prepend to the subject filled out in the contact form
$ax_mailSubject = "mysite.com - New Message";

// If you do not have a reCAPTCHA API Key - visit the following URL to signup
// http://www.google.com/recaptcha/whyrecaptcha
// If the following are left blank, this feature will simply be ignored

$ax_publicKey	   = "12456";
$ax_privateKey	   = "12345";
$ax_recaptchaTheme = "clean"; // valid values = red, white, blackglass, clean

// variables below corresponds to the Send to * in your contact form
// follow same formatting below to add new entries to the select box

$adminemail[] = array("name@mysite.com" => "Customer Service");

// text to display when form is submitted
$finishedtext = "Your email was successfully sent. We will be in touch soon.";

// reCAPTCHA Variables - do not modify unless these change
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");

// Read in options

//    $ax_reCaptcha        = false;

//    $px_recaptcha_challenge_field = isset($_POST['recaptcha_challenge_field']) ? $_POST['recaptcha_challenge_field'] : '';
//    $px_recaptcha_response_field  = isset($_POST['recaptcha_response_field']) ? $_POST['recaptcha_response_field'] : '';

$nameError        = "";
$emailError       = "";
$phoneNumberError = "";
$commentError     = "";
$sourceError      = "";
//    $recaptchaError = "";

// See if we're using reCaptcha
//    if (isset($ax_publicKey) && $ax_publicKey != '' &&    isset($ax_privateKey) && $ax_privateKey != '') {
//        $ax_reCaptcha = true;
//        require_once('libs/recaptcha.php');
//        $resp = recaptcha_check_answer ($ax_privateKey, $_SERVER['REMOTE_ADDR'], $px_recaptcha_challenge_field, $px_recaptcha_response_field);
//    }

// See if form was submitted
if (isset($_POST['axMail'])) {
    // Validate Name
    $contactName = filter_input(INPUT_POST, 'contactName', FILTER_SANITIZE_STRING);
    if ($contactName == '') {
        $nameError = 'Please enter a valid name.';
        $hasError  = true;
    }

    // Validate Email
    $email = filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL);
    if (!filter_var( $email, FILTER_VALIDATE_EMAIL )) {
	    $emailError = '' . $email . ' is <strong>NOT</strong> a valid email address.';
	    $hasError = true;
        }

    // Validate Phone
    $phoneNumber = filter_input(INPUT_POST, 'phoneNumber', FILTER_SANITIZE_STRING);

    if ($phoneNumber == '' || empty($phoneNumber)) {
	    $phoneNumberError = 'Please enter a valid phone number.';
	    $hasError = true;
    }

    // Validate Message
    $message = filter_input(INPUT_POST, 'message', FILTER_SANITIZE_STRING);
    if ($message == '') {
	    $commentError = 'Please enter a message to send.<br/>';
	    $hasError = true;
    }

    // Validate Address
    $source = filter_input(INPUT_POST, 'source', FILTER_SANITIZE_STRING);
    if ($source == '') {
	    $sourceError = 'Please select a source.';
	    $hasError = true;
    }

    // Validate reCaptcha
    //    if ($ax_reCaptcha && !$resp->is_valid) {
    //        $recaptchaError = 'The reCAPTCHA wasn\\'t entered correctly. Please try again.';
    //        $hasError = true;
    //    }

    // Capture Send To Email Addy
    $ax_mailTo = filter_input(INPUT_POST, 'emailTo', FILTER_SANITIZE_EMAIL);
    if (!filter_var($ax_mailTo, FILTER_VALIDATE_EMAIL)) {
        $emailError = '' . $ax_mailTo . ' is <strong>NOT</strong> a valid email address.';
        $hasError   = true;
    }
    // If we didn't hit an error, send the email
    if (!isset($hasError)) {
        // Body:
        $body = '
    Name: ' . $contactName . '
    Email: ' . $email . '
    Phone: ' . $phoneNumber . '
    Message: ' . $message . '
    Source: ' . $source . '
    ';

        // Headers
	$headers = 'From: ' . $email . "\\r\
" . 'Reply-To: ' . $email . "\\r\
";

        // Send it
        @ini_set('sendmail_from', $email);
        mail($ax_mailTo, $ax_mailSubject . ' : ' . $subject, $body, $headers);
        header('Location: script.php#bottomOfPage');
	exit;
    }

}
include('inc/header.php');

// Output template
echo '<div class="ax-outer">';
if (isset($emailSent) && $emailSent == true) {
	echo '<h1>Thanks, ' . $contactName . '</h1><p>' . $finishedtext . '</p>';
}
else {/*
	if ($ax_reCaptcha) {
		echo '
<script type="text/javascript">
var RecaptchaOptions = { theme : '.$ax_recaptchaTheme.' };
</script>';
	}*/
}
echo '<form action="script.php" id="ax-contactForm" method="post">';

if ($nameError != '') {
	echo '<p class="error">'.$nameError.'</p>';
}
echo 'Full Name:
<input type="text" name="contactName" id="contactName" title="name"
onfocus="if(this.value==this.defaultValue)this.value=\\'\\';"
onblur="if(this.value==\\'\\')this.value=this.defaultValue;"
value="';

if (isset($contactName)) echo $contactName;
echo '" class="requiredField ax-input" />';

if ($emailError != '') { echo '<p class="error">'.$emailError.'</p>'; }

echo 'Email:
<input type="text" name="email" id="email" title="email"
onfocus="if(this.value==this.defaultValue)this.value=\\'\\';"
onblur="if(this.value==\\'\\')this.value=this.defaultValue;" value="';

if (isset($email))  echo $email;
echo '" class="requiredField email ax-input" />';

if ($phoneNumber == '') { echo '<p class="error">'.$phoneNumberError.'</p>'; }

echo 'Phone#:
<input type="text" name="phoneNumber" id="phoneNumber"
title="number" onfocus="if(this.value==this.defaultValue)this.value=\\'\\';"
onblur="if(this.value==\\'\\')this.value=this.defaultValue;" value="';

if (isset($phoneNumber))  echo $phoneNumber;
echo '" class="ax-input" />';

if ($commentError != '') { echo '<p class="error">'.$commentError.'</p>'; }

echo 'Message:
<textarea name="message" id="message" title="message"
onfocus="if(this.value==this.defaultValue)this.value=\\'\\';"
onblur="if(this.value==\\'\\')this.value=this.defaultValue;"
rows="20" cols="30" class="requiredField ax-textarea">';

if (isset($message)) {
	if (function_exists('stripslashes')) {
		echo stripslashes($message);
        }
	else { echo $message; }
}

echo '</textarea>';

if ($source == '') { echo '<p class="error">'.$sourceError.'</p>'; }

echo '
<select type="text" name="source" id="source" title="source" class="requiredField ax-input" />
<option value="">How did you find us?</option>
';

$choices = array(
		 'Internet',
		 'Word of Mouth',
		'Sign',
		 'Truck',
		 'Yellowpages',
		 'Other'
		);
foreach ($choices as $choice) {
	if ($source == $choice) {
            $selected = 'selected="selected"';
        }
        echo "<option $selected value='$choice'>$choice</option>";
	$selected = "";
    }
echo '
</select>
<div style="display:none;">
<label for="emailTo" class="ax-label">Send To</label>
<select id="emailTo" name=\\'emailTo\\' class="requiredField ax-select">
';

for ($i = 0; $i < count($adminemail); $i++) {
	foreach ($adminemail[$i] as $key => $val) {
		echo '<option value="' . $key . '">' . $val . '</option>';
	}
}

echo '</select></div>';
/*
if ($ax_reCaptcha) {
	if ($recaptchaError != '') { echo '<p class="error">'.$recaptchaError.'</p>'; }
}
echo '
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k='.$ax_publicKey.'">
</script>
<noscript>
<iframe src="http://www.google.com/recaptcha/api/noscript?k='.$ax_publicKey.' height="300" width="300" frameborder="0"></iframe><br />
<textarea name="recaptcha_challenge_field" rows="3" cols="40"> </textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge" />
</noscript>';
*/
echo '<input type="hidden" name="axMail" id="axMail" value="true" />
<p><button type="submit" class="ax-button">Send Message</button></p>
</form>
</div>

include('inc/footer.php');
?>

Make sure you put this line:

<a name=“bottomOfPage”></a>';

just above the </body> tag

If your footer.php is small put a bunch of filler text in there so that you will see that it is indeed scrolled down to the bottom.