Page 1 of 1

Unstable includes menu but only on a php form page

Posted: Mon Jun 23, 2008 10:18 pm
by pjkinann
Hello,
My php form works great, but I noticed that somehow it causes my menu to reposition itself continually on mouseover. It is an includes menu. However, as a test, I replaced the includes menu with a standard UL menu, but it still changes positions. It moves back and forth horizontally.

Something ONLY on my form pages is causing the navigation to do this, and it has to be the php form because all the other pages on the site have a stable top nav.

I can't see anything obvious but a PHP guru probably could find this.

Hope someone can help.

Pages are:
http://www.pjkinann.com/AdvancedBusines ... ontact.php

http://www.pjkinann.com/AdvancedBusines ... ontact.php

http://www.pjkinann.com/AdvancedBusines ... eneral.php

Menu on all other pages of the site is stable:
http://www.pjkinann.com/AdvancedBusinessSales/index.php

This is the code above the doctype:

Code: Select all

<?php
include('../captcha/captchac_lib.php');  
$admin_email = 'pjkinann@mac.com'; 
$contact_subject = 'Advanced Business Sales: Message'; 
$contact_sentpage = 'sent.php'; 
$contact_notification_subject = 'Thank you for contacting Advanced Business Sales.'; 
$contact_notification_message = 'This is an automated response to let you know that your message was received. We will contact you within 24 hours.'; 
 
if(isset($_POST['form_contact_submit']) && $_POST['form_contact_submit'] == 'Send Message') {
$error=array();
$contact_name = '';
$contact_email = '';
$contact_message = '';
 
// Grab name
if(isset($_POST['form_contact_name']) && !empty($_POST['form_contact_name'])) {
    $contact_name = stripslashes($_POST['form_contact_name']);
} else {
    $error['contact_name'] = 'You have not provided your name.';
}
 
// Grab Email
if(isset($_POST['form_contact_email']) && !empty($_POST['form_contact_email'])) {
    $contact_email = trim($_POST['form_contact_email']);
} else {
    $error['contact_email'] = 'You have not provided your email address.';
}
// Test validity
if($contact_email) {
    $email_pattern = "/^[\.\-\w]+@[\.\-\w]+\.[^\.\W\d]{2,4}$/i";
    if(!preg_match($email_pattern,$contact_email)) {
        $error['contact_email_invalid'] = 'Your email address appears to be invalid.';
    }
}
 
// Grab the message
if(isset($_POST['form_contact_message']) && !empty($_POST['form_contact_message'])) {
    $contact_message = stripslashes($_POST['form_contact_message']);
} else {
    $error['contact_message'] = 'You have not added your message.';
}
 
$Turing_code = $_REQUEST["Turing"]; 
if ( CheckCaptcha($Turing_code) !=1 )
    $error['contact_message'] = 'The captcha code is incorrect. Please try again!';
 
// Email variables
$compile_message = "Name: $contact_name\r\n";
$compile_message .= "Email: $contact_email\r\n";
$compile_message .= $contact_message;
$headers_contact = "From: $contact_name <$contact_email>\r \n";
$headers_notification = "From: $admin_email <$admin_email>\r \n";
if(!$error) {
    mail($admin_email, $contact_subject, $compile_message, $headers_contact);
    mail($contact_email, $contact_notification_subject, $contact_notification_message, 
    $headers_notification);
    header("location: $contact_sentpage");
}
}
?>

This is the html and php form within the document:

Code: Select all

<!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" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Advanced Business Sales</title>
<link href="../css/AdvBus.css" rel="stylesheet" type="text/css" />
<!--[if LTE IE 6]>
<link href="../css/ie.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->
<!--[if IE 7]>
<link href="../css/ie7.css" rel="stylesheet" type="text/css" media="screen" />
<![endif]-->
<link href="../css/form.css" rel="stylesheet" type="text/css" />
</head>
<body id="buyerscontactpage" class="twocol">
<div id="wrapper">
  <div id="header"> <img src="../images/title1.gif" alt="Welcome to Stirling" name="title" width="255" height="29" id="title" />
    <?php include('../includes/topnav.php'); ?>
    <!-- The clear below keeps the navigation inside the header on resize -->
    <div class="clearit"></div>
    <!-- close header -->
  </div>
  <div id="strap">
    <!-- close strap -->
  </div>
  <div id="content">
    <h1>Buyer's Services </h1>
    <div id="innerwrapper">
      <div id="rightcol"><img src="images/steeple.jpg" alt="Stirling Steeple" width="161" height="121" /><img src="images/robert_the_bruce.jpg" alt="Robert the Bruce" width="161" height="121" /><img src="images/uni.jpg" alt="university" width="161" height="121" /></div>
      <div id="leftcol">
        <?php include('../includes/buyers.php'); ?>
        <!-- close leftcol -->
      </div>
      <div id="innercontent">
        <h2>Contact Us </h2>
        <h4>We will contact you within 24 hours.</h4>
        <?php
if(!$error) {
    print '<p><strong>Note</strong>: 
   All fields of the form are required.</p>'."\n";
} else {
    print '<p>Could not process form because you have left something out. 
    Please correct the errors listed below:</p>'."\n";
    print '<ul id="list-error">'."\n";
    foreach($error as $key => $value) {
        print '<li>'.$value.'</li>'."\n";
    }
    print '</ul>'."\n";
}
?>
        <form id="form-contact" action="<?php print $_SERVER['PHP_SELF']; ?>" method="post">
          <div>
            <label for="form-contact-name">Your Name:</label>
            <input type="text" id="form-contact-name" name="form_contact_name" <?php if(isset($_POST[
'form_contact_name'])) { print 'value="'.$_POST['form_contact_name'].'"'; } ?> />
            <label for="form-contact-email">Your email:</label>
            <input type="text" id="form-contact-email" name="form_contact_email" <?php if(isset($_POST['form_contact_email'])) { print 'value="'.$_POST['form_contact_email'].'"'; } ?> />
            <label for="form-contact-message">Your Message:</label>
            <textarea cols="40" rows="14" id="form-contact-message" name="form_contact_message"> <?php if(isset($_POST['form_contact_message'])) { 
   print stripslashes($_POST['form_contact_message']); } ?>
</textarea>
            <table cellpadding=5 cellspacing=0 bgcolor="#E4F8E4">
              <tr bgcolor="#AAD6AA">
                <td colspan="2"><font color="#FFFFFF" face="Verdana" size="2"><b>Image Verification</b></font></td>
              </tr>
              <tr>
                <td style="padding: 2px;" width="10"><img src="/captcha/captchac_code.php" id="captcha"></td>
                <td valign="top"><font color="#000000">Please enter the text from the image</font> &nbsp; <br>
                  <input type="text" name="Turing" value="" maxlength="100" size="10">
                  [ <a href="#" onclick=" document.getElementById('captcha').src = document.getElementById('captcha').src + '?' + (new Date()).getMilliseconds()">Refresh Image</a> ] [ <a href="/captcha/whatisturing.html" onClick="window.open('/captcha/whatisturing.html','_blank','width=400, height=300, left=' + (screen.width-450) + ', top=100');return false;">What's This?</a> ] </td>
              </tr>
            </table>
            <input type="submit" id="form-contact-submit" name="form_contact_submit" value="Send Message" />
          </div>
        </form>
        <p>Information needed on this form:</p>
        <ul>
          <li>First Name:</li>
          <li>Last Name: </li>
          <li>Phone: </li>
          <li>Cell Phone:</li>
          <li> Fax:</li>
          <li> Email Address: </li>
          <li>Description of a business you are interested in:</li>
          <li> Geographic Location of the Business you are interested in: </li>
          <li>Available Capital:</li>
          <li> Other comments: </li>
        </ul>
        <!-- close innercontent -->
      </div>
      <div id="footer2col">
        <?php include('../includes/footer.php'); ?>
      </div>
      <!-- The clear below keeps the content longer than the left nav -->
      <div class="clearit"></div>
      <!-- close innerwrapper -->
    </div>
    <!-- close content -->
  </div>
  <!-- close wrapper -->
</div>
</body>
</html>
 
Thank you in advance.
PJ

Re: Unstable includes menu but only on a php form page

Posted: Mon Jun 23, 2008 10:51 pm
by califdon
Hi PJ, welcome to phpdn.

What you're observing isn't caused by your php include, what's happening is that you're using a different font-family in your mouse-over logic, so that when you mouse-over a menu item, the length of the text of that word changes slightly, giving the effect of horizontal movement. If you use the same font-family, font-weight and font-size, that won't happen. Check your CSS.

Re: Unstable includes menu but only on a php form page

Posted: Mon Jun 23, 2008 11:06 pm
by pjkinann
thank you so much
I was stumped because my entire site is based off a stylesheet, but when you said that about the fonts I got to looking and then I realized OH <whacking forehead> RIGHT! my form page has a stylesheet of its own! So I checked and sure enough I had a different font on the form stylesheet! :banghead:

Thank you so much!!!! :D :mrgreen: