Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    616
    Thanks
    48
    Thanked 65 Times in 65 Posts

    Posting Without a Form

    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:
    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").
    Last edited by djh101; 07-03-2010 at 02:16 AM.

  • #2
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,

    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

    Regards
    Ameen


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •