marmite Posted April 16, 2007 Share Posted April 16, 2007 I am recoding my site. The new site is centred and should take up the middle 750 pixels of the screen. I have two dropdowns on the left nav by which the user can filter the products, so on index.php they click e.g. birthday cards, and click Find, and are taken to greetingscards.php, showing (you guessed it) all the birthday cards. The first dropdown is "theme" and the second is "message". Depending on the dropdown item they pick, the entire site shifts about 5pixels to the right. It's madness, and it looks unprofessional. The "theme" options on which the shift occurs are: floral and travel The "message" options on which the shift occurs are: Birthday, Christmas, Get Well, Congrats and Thanks. The latter might hold a clue as the SQL is different for these "messaged" cards. But beyond that I am well and truly stuck. Code below, any help grovellingly grateful for. <? require 'db.inc.php'; if (($_POST['submit3']) || ($_POST['submit4']) ) { if (($_POST['submit3']) && ($_POST['submit4']) ) { $theme=$_POST['theme']; $message=$_POST['message']; } elseif ($_POST['submit3']) { $theme=$_POST['theme']; $message='all'; } elseif ($_POST['submit4']) { $message=$_POST['message']; $theme='all'; } if ($message=='all') { $message2='all'; } elseif ($message=='nonblank') { $message2='nonblank'; } elseif ($message=='blank') { $message2='blank'; } elseif ($message=='birthday' OR $message=='blank' OR $message=='congrats' OR $message=='getwell' OR $message=='christmas' OR $message=='thankyou') { $message2='specific'; $message1="'" . $message . "'"; } if ($theme=='all') { $theme2='all'; } elseif ($theme=='animal' OR $theme=='floral' OR $theme=='leisure' OR $theme=='travel') { $theme2='specific'; $theme1="'" . $theme . "'"; } if (($message2=='all') && ($theme2=='all')) { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1)"; } elseif (($message2=='all') && ($theme2=='specific')) { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_id in (select card_categ_cards from cu_card_categ where card_categ_type='theme' and card_categ_name in ($theme1)))"; } elseif (($message2=='nonblank') && ($theme2=='all')) { $query="SELECT * FROM cu_image WHERE image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg <> 'blank')"; } elseif (($message2=='specific') && ($theme2=='all')) { $query="SELECT * FROM cu_image WHERE image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg in ($message1))"; } elseif (($message2=='nonblank') && ($theme2=='specific')) { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg <>'blank' and card_id in (select card_categ_cards from cu_card_categ where card_categ_name in ($theme1)))"; } elseif (($message2=='specific') && ($theme2=='specific')) { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg in ($message1) and card_id in (select card_categ_cards from cu_card_categ where card_categ_name in ($theme1)))"; } elseif (($message2=='blank') && ($theme2=='all')) { $query="SELECT * FROM cu_image WHERE image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg = 'blank')"; } elseif (($message2=='blank') && ($theme2=='specific')) { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1 and card_msg ='blank' and card_id in (select card_categ_cards from cu_card_categ where card_categ_name in ($theme1)))"; } } else { $query="SELECT * from cu_image where image_status=1 and image_id in (select card_image_id from cu_cards where card_status=1)"; } $id=$_POST['id']; $id=str_replace("_"," ",$id); $result=mysql_query($query); $numrows=mysql_num_rows($result); ?> <!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=iso-8859-1" /> <title>TEST CARDS UNLIMITED</title> <link href="style/phase2.css" rel="stylesheet" type="text/css"> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> </html> <!-- #BeginLibraryItem "/Library/Javascript.lbi" --> <script language="JavaScript" type="text/javascript"> <!-- Emma 7/3/07 These are Dreamweaver javascript functions which allow the rollovers on left navigation buttons EDIT IN HOMEPAGE ONLY function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } function validate(formCheck) { var mail = formCheck.email.value if (mail.indexOf("@") == -1) { alert("Please type a valid email address"); formCheck.email.focus(); return false; } alert("Thanks! Your information is being registered"); return true; } --> </script> <!-- #EndLibraryItem --> <!--- Emma 7/3/07 loads rollover images as page loads so javascript can use them without querying server ---> <body onLoad="MM_preloadImages('/buttons/home_a.gif','/buttons/view-cards_a.gif','/buttons/got-a-shot_a.gif','/buttons/vote-on-ranges_a.gif','/buttons/buy-in-bulk_a.gif','/buttons/pa-services_a.gif','buttons/shoppingcart_a.gif','/buttons/myaccount_a.gif','/buttons/about_a.gif','/buttons/contact_a.gif','/buttons/shoppingcart_a.gif')"> <div align="center"> <div id="maincontainer"> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="210"><div align="left"><a href="/New_CU/index.php"> <img src="images/cards-unlimited-logo_3.gif" alt="Cards Un Limited" width="177" height="69" border="0" /> </a> </div></td> <td width="540" scope="col"><table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="6"><img src="images/spacer.gif" width="1" height="5" alt="" /></td> </tr> <tr> <td><img src="images/spacer.gif" width="7" height="1" alt="" /></td> <td width="94"><a href="/New_CU/index.php"><img src="buttons/home_a2.gif" alt="Home" name="home" width="63" height="39" border="0" id="home" /></a></td> <td width="132"><a href="/New_CU/myaccount.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('my-account1','','buttons/myaccount_a.gif',1)"><img src="buttons/myaccount_na.gif" alt="My Account" name="my-account1" width="101" height="39" border="0" id="my-account1" /></a></td> <td width="94"><a href="/New_CU/about.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('about1','','buttons/about_a.gif',1)"><img src="buttons/about_na.gif" alt="About" name="about1" width="63" height="39" border="0" id="about1" /></a> </td> <td width="106"><a href="/New_CU/contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('contact1','','buttons/contact_a.gif',1)"><img src="buttons/contact_na.gif" alt="Contact" name="contact1" width="75" height="39" border="0" id="contact1" /></a> </td> <td width="107"><a href="/New_CU/cart.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('shoppingcart1','','buttons/shoppingcart_a.gif',1)"><img src="buttons/shoppingcart_na.gif" alt="Shopping Cart" name="shoppingcart1" width="107" height="39" border="0" id="shoppingcart1" /></a></td> </tr> <tr> <td colspan="6"><img src="images/spacer.gif" width="1" height="2" alt="" /></td> </tr> <tr> <td colspan="6"><div align="right"><span class="footercolor"> <? if (!$_SESSION['memberid'] or $_SESSION['memberid'] == "loggedout") { echo "You are not logged in; <a href=\"/login.php\">Log In</a>"; } else { echo "You are logged in; <a href=\"/logout.php\">Log Out</a>"; } ?> </span></div></td> </tr> </table></td> </tr> <tr> <td colspan="2" scope="row"><img src="images/spacer.gif" width="1" height="1" alt="" /></td> </tr> </table> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/fade.gif" width="750" height="2"></td> </tr> </table> <table width="750" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/spacer.gif" alt="" width="1" height="1"></td> </tr> <tr> <td><span class="footercolor"> <a href="/New_CU/index.php">Home</a> > <a href="/New_CU/greetingscards.php">Greeting cards</a></span></td> </tr> <tr> <td><img src="images/spacer.gif" alt="" width="1" height="1"></td> </tr> </table> <!--- LEFT NAV ---> <div id="leftnav"><!-- #BeginLibraryItem "/Library/leftnav.lbi" --> <div id="email_box"> <table width="100%"> <tr> <td width="100%" align="center"><form id="form1" name="form1" method="post" action="<?=$_SERVER['Library/PHP_SELF']?>"> <label></label> <input name="email" type="text" id="email" onfocus="this.value = ''; this.onfocus = function () {}" value="E-mail address" size="15" /> </label> <input type="submit" name="submit1" value="GO!" onclick="return validate(form1)" /> </form></td> </tr> </table> </div> <!--- LEFT NAV BOX ---> <div id="link_box"> <ul> <li> <a href="/about-us/" title="Greeting cards">Greeting cards</a></li> <li> <a href="/blog/" title="Upload to Photo competition">Photo competition: upload</a></li> <li> <a href="/information/rent-a-parking-space/" title="Vote in Photo competition">Photo competition: vote</a></li> <li> <a href="/press/" title="Free email reminders">Prices & Postage</a></li> </ul> </div> <div id="search_box"> <form action="/New_CU/greetingscards.php" method="post" name = "themes" id="themes"> <table width="90%"> <tr width="100%">Theme</tr> <tr> <td width="50px"><select name="theme" id="theme1"> <option value="all"<?php if($_POST['theme'] == "all") { echo ' selected="selected"'; } ?>>All</option> <option value="animal"<?php if($_POST['theme'] == "animal") { echo ' selected="selected"'; } ?>>Animal</option> <option value="floral"<?php if($_POST['theme'] == "floral") { echo ' selected="selected"'; } ?>>Floral</option> <option value="leisure"<?php if($_POST['theme'] == "leisure") { echo ' selected="selected"'; } ?>>Leisure</option> <option value="travel"<?php if($_POST['theme'] == "travel") { echo ' selected="selected"'; } ?>>Travel</option> </select></td> <td><input type="submit" name="submit3" value="Find cards!" /></td> </tr> </table> </form> <img src="Library/images/spacer.gif" width="1" height="13" alt="" /> <form action="/New_CU/greetingscards.php" method="post" name = "messages" id="messages"> <table width="90%"> <tr width="100%">Messages</tr> <tr> <td><select name="message" id="message1"> <option value="all"<?php if($_POST['message'] == "all") { echo ' selected="selected"'; } ?>>All</option> <option value="blank"<?php if($_POST['message'] == "blank") { echo ' selected="selected"'; } ?>>Blank</option> <option value="nonblank"<?php if($_POST['message'] == "nonblank") { echo ' selected="selected"'; } ?>>Non Blank</option> <option value="birthday"<?php if($_POST['message'] == "birthday") { echo ' selected="selected"'; } ?>>Birthday</option> <option value="congrats"<?php if($_POST['message'] == "congrats") { echo ' selected="selected"'; } ?>>Congratulations</option> <option value="getwell"<?php if($_POST['message'] == "getwell") { echo ' selected="selected"'; } ?>>Get Well Soon</option> <option value="thankyou"<?php if($_POST['message'] == "thankyou") { echo ' selected="selected"'; } ?>>Thank you</option> <option value="christmas"<?php if($_POST['message'] == "christmas") { echo ' selected="selected"'; } ?>>Christmas</option> </select> </td> <td><input type="submit" name="submit4" value="Find!" /></td> </tr> </table> </form> </div> <!-- #EndLibraryItem --><!--- MAIN SECTION ---> </div> <div id="middle"> <table border="0" cellpadding="0" cellspacing="0"> <tr><td> <?php if ($_GET['purpose']=='officegreetingcards') { echo '<div id="h2"> Office greeting cards </br></div> <div id="blurb">Are you the person who has to pop out and buy all the greeting cards for people at work? Are you paying £2 a pop? Crazy, isn’t it? </br></br> On this site, you can buy individual greeting cards for £1.20 each, packs of 5 mixed cards for £1 per card, or packs of 25 same-design cards for 50p per card. Click on a design you like, and the options - including mixed packs - will pop up, as if by magic!</br></br>If you know you would like only Birthday, or Get Well cards, please use the Message dropdown to your left.'; } elseif ($_GET['purpose']=='hotelgreetingcards') { echo '<div id="h2"> Hotel greeting cards </br></div> <div id="blurb">Our greeting cards are used in several prestigious hotels within the UK. </br></br> Greeting cards may be given to guests to welcome them, or to help celebrate a guest’s birthday or anniversary. Prices start from just 50p. Please click on a design you like to display the packaging options and prices. If you would like to narrow down the results, please use the dropdowns to your left.'; } else { echo '<div id="h2"> Greeting cards </br></div> <div id="blurb">We stock over 80 designs of greeting cards, all photographic, all square, and all available to you as a consumer from 50p, or as a retailer from 65p (individually wrapped in cellophane). Click on any of the images to see whether the card is available blank or messaged, and to see what the pricing options are.</div>'; } ?> </td></tr> <tr><td><img src="images/spacer.gif" width="1" height="5" alt=""></td></tr> <tr><td> <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <? if ($numrows > 0) { $count = 1; echo "<tr>"; $diff = $count % 5; while ($row = mysql_fetch_assoc($result)) { ?> <td><table width="90" border="0" align="center" cellpadding="0" cellspacing="3" onMouseOver="this.style.backgroundColor='#5EB6D3';" onMouseOut="this.style.backgroundColor='#FFFFFF';"> <tr> <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#666666"> <tr bgcolor="#FFFFFF"> <td><a href="/New_CU/bulkview.php?id=<? echo strtolower(str_replace(" ", "_", $row['image_name']));?>"><img src="<? echo $row['image_link']; ?>" width="90" height="90" border="0"></a></td> </tr> </table></td> </tr> </table></td> <? $diff = $count % 5; if (($count % 5) == 0) { ?> </tr> <tr> <td colspan="5"> </td> </tr> <? } $count++; } ?> </table> <? } else { echo "<tr> </tr>"; } ?> </td></tr> <tr><td><img src="images/spacer.gif" width="1" height="5" alt=""></td></tr> <tr><td class="style8"><div align="center" class="style6"></div></td></tr> </table> </div> <!--- ROW FOUR ---><!-- #BeginLibraryItem "/Library/bottombar.lbi" --><div id="bottom_bar"> <div id="shopsafe"><a href="http://www.shopsafe.co.uk" target="_top"><img src="http://www.shopsafe.co.uk/logos/shopsafe.gif" width="100" height="100" alt="Shopsafe approved: click to go to their website" border="0" /></a></div> <div id="bottom_bar_text"> <ul> <a href="/new_cu/index.php">Home</a> | <a href="Library/new_cu/myaccount.php">My Account</a> | <a href="Library/new_cu/about.php">About</a> | <a href="Library/new_cu/contact.php">Contact</a> | <a href="Library/new_cu/cart.php">Cart</a> </ul> <ul> <a href="Library/new_cu/termsandconditions.php">Terms and Conditions</a> | <a href="Library/new_cu/privacypolicy.php">Privacy Policy</a> | <a href="Library/new_cu/termsofuse.php">Terms of Use</a> </ul> <ul> <a href="Library/new_cu/partyinvitations.php">Party Invitations</a> | <a href="Library/new_cu/weddinginvitations.php">Wedding Invitations</a> | <a href="Library/new_cu/greetingscards.php?purpose=hotelgreetingcards">Cards for hotels</a> </ul> </div> </div> <!-- #EndLibraryItem --></div> </div> <!--- to set the dropdown values to the GET method ---> <?php if ($_POST['submit2']) { $theme=$_POST['theme']; $purpose=$_POST['purpose']; $message=$_POST['message']; } ?> <!--- to post the email information to the server---> <?php if ($_POST['submit1']) { $email=trim($_POST['email']); $query="INSERT INTO email (email_address) VALUES ('$email')"; $result=mysql_query($query); } ?> </body> </html> Link to comment https://forums.phpfreaks.com/topic/47285-entire-site-shifts-to-right-by-5-pixels/ Share on other sites More sharing options...
anthylon Posted April 16, 2007 Share Posted April 16, 2007 Well if you asking why your entire site doesn't fit to the top/left corner try using <body topmargin or top-margin... and the same for left margine. Dreamweaver will give you all you just need start with... Sorry... Link to comment https://forums.phpfreaks.com/topic/47285-entire-site-shifts-to-right-by-5-pixels/#findComment-230659 Share on other sites More sharing options...
freakstyle Posted April 16, 2007 Share Posted April 16, 2007 hey marmite, this sounds like a css issue, if you post a link to the html someone may be able to offer more insight into the shifting issue. (or in the least, post the css file) Anthylon's suggestion of using dreamweaver is null, learning to code by hand will help you become a better developer, period. ps. any style should be declared in an external css file, body {margin:0px 0px 0px 0px;) will remove the body margins. the attribute "align=center" on the div is depreciated, an equal value would be in your css... #maincontainer {margin:0px auto 0px auto;} hope this helps a bit, but like i said, drop in your url or css file for more info Link to comment https://forums.phpfreaks.com/topic/47285-entire-site-shifts-to-right-by-5-pixels/#findComment-230743 Share on other sites More sharing options...
marmite Posted April 17, 2007 Author Share Posted April 17, 2007 Hey guys, thanks for suggestions. But why would CSS shift things differently depending on the selection from a dropdown?? The same page is called when they click Submit, calling the same external CSS file ??? I still think it must be the SQL. But... que? Here's the code, though. Thanks, Emma /* CSS Document */ .footercolor { font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #1B82A7; } #maincontainer { width: 750px; text-align: left; color: #1B82A7; margin-top:30px; position:relative; } #leftnav { dislay:block; width:210px; float:left; } #email_box { background-image: url(../images/email_box.gif); background-repeat: no-repeat; height: 48px; padding-top:35px; margin-top:10px; } #link_box ul{ margin: 0px; padding: 0px; padding-left:50px; list-style-type: none; } #link_box { background-image: url(../images/Left_nav.gif); background-repeat: no-repeat; height: 153px; padding-top:0px; color: #1B82A7; margin-top:12px; } #link_box li{ list-style-type: none; font-family: Arial, Helvetica, sans-serif; font-size:12px; text-decoration: none; color: #1B82A7; padding-top:12px; line-height: 23px; } #link_box li a{ list-style-type: none; font-family: Arial, Helvetica, sans-serif; text-decoration: none; font-weight:bold; color: #1B82A7; } #link_box li a:hover{ text-decoration: underline; } #search_box { background-image: url(../images/Search_box.gif); font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #1B82A7; font-weight: normal; background-repeat: no-repeat; height: 180px; padding-left:10px; margin-top:17px; padding-top:50px; } #testimonial { background-image: url(../images/testimonial_1.gif); background-repeat: no-repeat; height:150px; display:block; width:190px; float:left; margin-left:5px; margin-top:-40px; } #shopsafe { padding-top:6px; padding-left:10px; margin-top:0px; margin-left:0px; float:left; } #gca { padding-top:38px; padding-left:230px; margin-top:0px; margin-left:0px; float:left; } #middle { display:block; float:right; width:540px; } #h1 { font-size: large; color: #1B82A7; padding-bottom: 5px; font-weight:normal; } p { color:#000000; font-family: Arial, Helvetica, sans-serif; line-height:16px; margin-top:0px; margin-left:5px; font-size:12px; } #bottom_box { display:block; background-image: url(../images/bottom_box.gif); background-repeat:no-repeat; width: 382px; height:180px; margin-top:10px; } #bottom_box ul { list-style-type: none; padding-left:0px; line-height:25px; margin-left:0px; text-align:left; padding-top:35px; margin-top:0px; } #bottom_box_1 { float:left; padding-left:10px; margin-left:0px; } #bottom_box_2 { float:left; padding-left:0px; margin-left:0px; } #bottom_box a { font-size: 12px; color: #1B82A7; text-decoration: none; } #bottom_box a:hover{ text-decoration: underline; } div.row span.left { float: left; text-align: left; color:#ffffff; font-weight: bold; width: 49%; } div.row span.right { float: right; text-align: right; font-weight: bold; color: #fff; width: 49%; } #bottom_bar { display:block; background-image: url(../images/bottom_bar.gif); background-repeat:no-repeat; height: 113px; width:750px; clear:both; margin-top:60px; } #bottom_bar_text { font-size:12px; float:right; padding-right:10px; padding-top:10px; } #bottom_bar_text a { font-size: 12px; color: #1B82A7; font-weight:lighter; text-decoration: none; clear:right; } #bottom_bar_text a:hover{ text-decoration: underline; } #cardview { display:block; padding-left:10px; } #normal { color: #1B82A7; font-size: 12px; } #blurb { color: #1B82A7; font-size: 14px; padding-left:5px; padding-bottom:10px; text-align:left; } #packbox { font-size:12px; } #h2 { font-size: large; color: #1B82A7; padding-bottom: 7px; font-weight:strong; padding-left:5px; } #h3 { font-size: 18px; color: #1B82A7; padding-bottom: 7px; } #h4 { font-size: 14px; color: #1B82A7; padding-bottom: 7px; } #h5 { font-size: 12px; font-weight:bold; color: #1B82A7; padding-bottom: 7px; } body { margin-left: 5px; margin-top: 5px; margin-right: 5px; margin-bottom: 0px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } Link to comment https://forums.phpfreaks.com/topic/47285-entire-site-shifts-to-right-by-5-pixels/#findComment-231096 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.