djh101
07-02-2010, 10:28 AM
I've heard that you shouldn't use tables to style a page, so if anyone knows a better way, please tell me. Anyway, here is my code:
<table style="border-width: 0px; text-align: left;">
<form name="site1" method="post" action="user.php?select=3">
<tr style="border-width: 0px;">
<td style="border-width: 0px;" width="150">Category</td>
<td style="border-width: 0px;" width="200"><select name="s1category">
<option>--</option>
<option>Art & Culture</option>
<option>Business</option>
<option>Business (e-commerce)</option>
<option>Educational/Instructional</option>
<option>Entertainment</option>
<option>Gaming</option>
<option>Index</option>
<option>Informational</option>
<option>Miscellaneous</option>
<option>News & Politics</option>
<option>Social</option>
</select></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">URL</td>
<td style="border-width: 0px;">http://<input type="text" name="s1url" maxlength="50" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Name</td>
<td style="border-width: 0px;"><input type="text" name="s1name" maxlength="30" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Tags (separated by commas)</td>
<td style="border-width: 0px;"><input type="text" name="s1tags" maxlength="100" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Short Description</td>
<td style="border-width: 0px;"><input type="text" name="s1description" maxlength="100" size="50"></td></tr>
<input type="hidden" name="submitted" value="true">
<tr style="border-width: 0px;">
<td style="border-width: 0px;" width="150"></td>
<td style="border-width: 0px;"><?php if ($site_exist >= 1){ //CHANGES BUTTON FROM SUBMIT TO UPDATE IF SITE ALREADY EXISTS TO AVOID CONFUSION
echo "<input type=\"submit\" name=\"submit\" value=\"Update\">";
} else { echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
} ?></form></td>
<td><form name="deleteSite" method="post" action="user.php?select=3" id="deleteSite" value="true">
<input type="submit" name="delete" value="Delete"
onClick="return confirmSubmit()">
</form></td></tr>
<script type="text/javascript"><!--
function confirmSubmit(){
var agree=confirm("Are you want to delete this site from our index?");
if (agree) return true ;
else return false ; } // -->
</script>
</table>
The tables are pretty much working fine except for one problem. I want the delete button to go next to the submit button. However, I don't see a way I could go about doing that without:
a. Making the submit cell smaller and having all other cells span 3 cells, closing the first form right after the submit cell (which would be improper coding since the form started before the row and must close outside the row), and placing the delete button inside an adjacent cell.
b. Removing row tags and doing the above (not sure how well that will work or how good it will look).
If you want to see the problem, the URL is http://simplyuseless.info/publishare/user.php?select=3 (login first with username="testing" password="testing").
<table style="border-width: 0px; text-align: left;">
<form name="site1" method="post" action="user.php?select=3">
<tr style="border-width: 0px;">
<td style="border-width: 0px;" width="150">Category</td>
<td style="border-width: 0px;" width="200"><select name="s1category">
<option>--</option>
<option>Art & Culture</option>
<option>Business</option>
<option>Business (e-commerce)</option>
<option>Educational/Instructional</option>
<option>Entertainment</option>
<option>Gaming</option>
<option>Index</option>
<option>Informational</option>
<option>Miscellaneous</option>
<option>News & Politics</option>
<option>Social</option>
</select></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">URL</td>
<td style="border-width: 0px;">http://<input type="text" name="s1url" maxlength="50" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Name</td>
<td style="border-width: 0px;"><input type="text" name="s1name" maxlength="30" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Tags (separated by commas)</td>
<td style="border-width: 0px;"><input type="text" name="s1tags" maxlength="100" size="30"></td></tr>
<tr style="border-width: 0px;">
<td style="border-width: 0px;">Short Description</td>
<td style="border-width: 0px;"><input type="text" name="s1description" maxlength="100" size="50"></td></tr>
<input type="hidden" name="submitted" value="true">
<tr style="border-width: 0px;">
<td style="border-width: 0px;" width="150"></td>
<td style="border-width: 0px;"><?php if ($site_exist >= 1){ //CHANGES BUTTON FROM SUBMIT TO UPDATE IF SITE ALREADY EXISTS TO AVOID CONFUSION
echo "<input type=\"submit\" name=\"submit\" value=\"Update\">";
} else { echo "<input type=\"submit\" name=\"submit\" value=\"Submit\">";
} ?></form></td>
<td><form name="deleteSite" method="post" action="user.php?select=3" id="deleteSite" value="true">
<input type="submit" name="delete" value="Delete"
onClick="return confirmSubmit()">
</form></td></tr>
<script type="text/javascript"><!--
function confirmSubmit(){
var agree=confirm("Are you want to delete this site from our index?");
if (agree) return true ;
else return false ; } // -->
</script>
</table>
The tables are pretty much working fine except for one problem. I want the delete button to go next to the submit button. However, I don't see a way I could go about doing that without:
a. Making the submit cell smaller and having all other cells span 3 cells, closing the first form right after the submit cell (which would be improper coding since the form started before the row and must close outside the row), and placing the delete button inside an adjacent cell.
b. Removing row tags and doing the above (not sure how well that will work or how good it will look).
If you want to see the problem, the URL is http://simplyuseless.info/publishare/user.php?select=3 (login first with username="testing" password="testing").