View Full Version : Resolved Posting Without a Form

07-02-2010, 11: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>Art & Culture</option>
<option>Business (e-commerce)</option>
<option>News & Politics</option>
<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()">
<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 ; } // -->
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").

07-02-2010, 01:48 PM

I checked your code,

You can use only one form and close the form tag properly at the end, and for delete button just try calling your action using javascript, instead of using one more form.

if you want to use two forms then use <DIV> instead of <table>

or another method close the previous table and have the delete part in div section and move the div to the required position using css