Jump to content

Basic HTML Textfield alignment in table column Question?


Jakesta42

Recommended Posts

Hello,

 

I'm writing a PHP program in which textfields are printed (in a loop) into an HTML table. On a button click, another column is added to the table, and another textfield added. The problem is that when a new textfield is printed, it is slightly above the height of the other textfields (see attached picture if unclear).

 

The code for this is below:

 


<table border = '1' cellspacing = '4' style = "color: white">
<?php
include "connectToDatabase.php"; //Initial script call to generate table from database 
?>
</table>

//Code in connectToDatabase.php...

$query = mysql_query("SELECT * FROM colin_table");
while($row = mysql_fetch_array($query)){
//$row represents each row in an array
for($i = 0; $i < $limit; $i++){
//Print every element in the array
if($row[$i] == null) echo "<td align = 'center'><input type = 'text' style = 'text-align: center; vertical-align: middle' align = 'center'>";
else echo "<td align = 'center'>" . $row[$i];
}
echo "<td align = 'center'>";
echo "<tr align = 'center'>";
//Then move to the next row
}

//Loop that prints text boxes for every column in the HTML table
$textBoxQuery = mysql_query("SELECT * FROM allColumnFields");
while($row = mysql_fetch_array($textBoxQuery)){
echo <<<END
<td align = 'center'> <input type = 'text' style="margin-left:auto; text-align:center; vertical-align: middle; margin-right:auto;" name = "rowField"/>
END;
//THIS IS THE PART THAT NEEDS WORK. FOR SOME REASON NEW TEXTBOX IS HIGHER THAN THE OTHER BOXES
}

 

It's more of an aesthetic problem, but it's nonetheless something I'd like to get fixed.

 

Any ideas?

 

Jake

post-131702-13482403238868_thumb.png

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.