Hello and welcome to our community! Is this your first visit?
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
    Thanked 67 Times in 67 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:
    <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").
    Last edited by djh101; 07-03-2010 at 03:16 AM.

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

    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



    Posting Permissions

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