Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

table layout problem

5:47 pm on Dec 15, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2005
posts: 486
votes: 0

I have some PHP code that puts in an input box and then a submit button.
The end of the input box, xxQuant, has a </td></tr> line and then an </table> so the submit button goes onto the next line.
I keep trying to remove the </td></tr> bit and move the button up but it messes up the layout.
Any ideas which bit I should be changing?

if($optjs!='') print '<script language="javascript" type="text/javascript">/* <![CDATA[ */'.$optjs.'/* ]]> */</script>';
if($prodoptions[0]['optType']==4) $thestyle=''; else $thestyle=' width="100%"';
if($optionshtml!='') print '<div class="detailoptions" align="center"><table class="prodoptions detailoptions" border="0" cellspacing="1" cellpadding="1"'.$thestyle.'>' . $optionshtml;
if($isInStock && @$nobuyorcheckout != true && (@$showquantondetail==TRUE || ! @isset($showquantondetail)) && $hasmultipurchase==0){ ?>
<tr><td align="right"><?php print $xxQuant?>:</td><td align="left"><input type="text" name="quant" size="4" maxlength="5" value="1" alt="<?php print $xxQuant?>" />[B]</td></tr>[/B]<?php
if($optionshtml!='') print '</table></div>';
if($isInStock && @$nobuyorcheckout != true && (@$showquantondetail==TRUE || ! @isset($showquantondetail))){ ?>
<table border="0" cellspacing="1" cellpadding="1" width="100%">
<tr><td align="right"><?php print $xxQuant?>:</td><td><input type="text" name="quant" size="4" maxlength="5" value="1" alt="<?php print $xxQuant?>" /></td></tr>
[B]<p align="center">[/B]

if(@$nobuyorcheckout == TRUE)
print '&nbsp;';
if($rs['pPrice']==0 && @$nosellzeroprice==TRUE){
print '&nbsp;';
writehiddenvar('id', $rs['pId']);
writehiddenvar('mode', 'add');
if($wishlistondetail) writehiddenvar('listid', '');
if(@$custombuybutton != '') print $custombuybutton; else print imageorsubmit(@$imgbuybutton,$xxAddToC,'buybutton');
if($wishlistondetail) print '<br />' . imageorlink(@$imgaddtolist,$xxAddLis,'gtid='.$Count.';return displaysavelist(event,window)',TRUE);
print imageorlink(@$imgnotifyinstock, $xxNotBaS, "return notifyinstock(false,'".str_replace("'","\\'",$rs['pId'])."','".str_replace("'","\\'",$rs['pId'])."',".($rs['pStockByOpts']!=0&&!@$optionshavestock?'-1':'0').")", TRUE);
print '<strong>'.$xxOutStok.'</strong>';
print '<br />';
10:49 pm on Dec 15, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Feb 22, 2009
votes: 0

Hi there jackvull,

turn error_reporting(E_ALL) within the scope of this script and see how many errors there are first off, personally for my liking (pedant & 'proper' coding practice are bug bears of mine) there is too much error surpressing going on (@isset($var)) surely you want to know what if anything is going wrong within your code...

>> <?php print $xxQuant?> and this doesn't look right to me, looks like there are line terminators (;) missing from that statements on these, though I could be wrong...

There are missing {} braces from if/else statements too, and yet on the previous ones you have them.

Don't mean to sound like I'm telling you off (which incidentally I'm not) I'm just seeing things that *might* cause your script to malfunction.

10:55 am on Dec 16, 2011 (gmt 0)

Preferred Member

10+ Year Member

joined:June 16, 2005
posts: 486
votes: 0

It's not my script.
Personally, I would never have made the code so complex but there you go, I have to work with it.
4:28 pm on Dec 16, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
votes: 0

Ugh. Horrors on so many levels. :-)

Try changing this

<p align="center">

to this

<p style="text-align:center; margin:0; padding:0;">

The button comes after that p (miraculously), right?