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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.