Jump to content

PHP HTML Spreading Images??


cjbeck71081

Recommended Posts

I have been working on this page all day with help from everyone in the forum.  But as i figure one thing out, and turn a corner, the next thing hits me, that ive never seen before.

take a look at this page, i cannot figure out what is wrong.  Every few times the page is loaded, it loads just fine, just as I want it to.  But if you hit F5 to reload it a few times, the two images (which are supposed to be near each other, are pushed away from each other.  I tried to put restraints on the table width, but it doesnt seem to do any good.

www.epicri.com/bdd/form3.php

Here is the code.  Thanks for your help guys, if it werent for the nice people that post, i wouldnt be nearly finished with this.

[code]<?php

$hostname = "xxxxx";
$username = "xxxxx";
$password = "xxxxx";
$usertable = "bddtable";
$dbName = "epicr001";
$propname = $_POST['propname'];

?>

<?php

$con = mysql_connect($hostname,$username,$password);
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db($dbName, $con);

$result = mysql_query("SELECT * FROM $usertable");
?>

<body>

<?php
echo "<table width='317' border='0' align='center' cellpadding='0'>";
while($row = mysql_fetch_array($result)){

$test = $row['propname'];
$beforepic = $row['beforepic'];
$afterpic = $row['afterpic'];

echo "<tr>
    <td height='35' width='310' colspan='2'><p align='left' class='style1'>$test</p>    </td>
<tr>";
echo "<td align='center' class='style2' width='164' height='100'>Before<a href='$beforepic' TARGET='2nd_wind'><img src='$beforepic' height='95%' width='95%' border='0' /></td>
    <td  align='center' class='style2' width='164' height='100'>After
    <a href='$afterpic' TARGET='2nd_wind'><img src='$afterpic' height='100%' width='95%' border='0' /></td>
  </tr>";
}
echo "</table>";
?>





</body>[/code]
Link to comment
https://forums.phpfreaks.com/topic/31397-php-html-spreading-images/
Share on other sites

Missing </tr> and < /a >. Also looking at your html source, you have 2 <head> and <title> tags.
[code]
<?php
echo "<table width='317' border='0' align='center' cellpadding='0'>";
while($row = mysql_fetch_array($result)){

$test = $row['propname'];
$beforepic = $row['beforepic'];
$afterpic = $row['afterpic'];

echo "<tr>
        <td height='35' width='310' colspan='2'><p align='left' class='style1'>$test</p></td>
      </tr>
      <tr>
        <td align='center' class='style2' width='164' height='100'>Before<a href='$beforepic' TARGET='2nd_wind'><img src='$beforepic' height='95%' width='95%' border='0' alt=''/></td>
        <td  align='center' class='style2' width='164' height='100'>After
          <a href='$afterpic' TARGET='2nd_wind'><img src='$afterpic' height='100%' width='95%' border='0' alt='' /></a>
        </td>
      </tr>";
}
echo "</table>";
[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.