Formular über mehrere Zellen/Spalten

Status
Nicht offen für weitere Antworten.

unlord

Erfahrenes Mitglied
Hoi,
der Titel sagt eigentlich schon alles... funktioniert das irgendwie? mit einem Submit-Button? oder muss ich alles umbauen bzw kann man überhaupt in ein <form>-tag mehrere DIVs reinstecken?

hier mal der Codeschnipsel:
HTML:
<tr>
<td width="323" style="padding-bottom: 4px;">
<form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
				<?php
				...
				?>
<span class="heading">
Name:&nbsp;
</span><input type="text" class="gb_input" name="gb_name">

				<?php
				....
				?>
</form>
</td>
</tr>
	<?php
	....
	?>
<tr>
<td width="323" height="2" style="background-color: #474747;"></td>
</tr>
	<?php
	...
	?>
<tr>
<td width="323" style="padding-top: 5px;">
<form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
				<?php
				...
				?>
<textarea class="gb_text" name="gb_text" cols="0" rows="0"></textarea>
				<?php
				...
				?>
</form>
</td>
</tr>
<tr>
<td valign="top" align="center" width="323" style="padding-top: 10px;">
<form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
				<?php
				...
				?>
<input type="submit" class="gb_submit" value="Eintragen">
				<?php
				...
				?>
</form>
</td>
</tr>

so wie ich das hier gemacht habe funtkioniert es natürlich leider nicht :/

danke schonmal
 
Hi,

die Formularelemente (input type=text,textarea,input type=submit) werden gemeinsam in einem <form> ... </form>-Tag eingebettet:

Code:
<tr>
<td width="323" style="padding-bottom: 4px;">
<form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
				<?php
				...
				?>
<span class="heading">
Name:&nbsp;
</span><input type="text" class="gb_input" name="gb_name">

				<?php
				....
				?>
</td>
</tr>
	<?php
	....
	?>
<tr>
<td width="323" height="2" style="background-color: #474747;"></td>
</tr>
	<?php
	...
	?>
<tr>
<td width="323" style="padding-top: 5px;">
				<?php
				...
				?>
<textarea class="gb_text" name="gb_text" cols="0" rows="0"></textarea>
				<?php
				...
				?>
</td>
</tr>
<tr>
<td valign="top" align="center" width="323" style="padding-top: 10px;">
				<?php
				...
				?>
<input type="submit" class="gb_submit" value="Eintragen">
				<?php
				...
				?>
</form>
</td>
</tr>
Die Anzahl der enthaltenen DIVs spielt hierbei überhaupt keine Rolle.
 
Zeig doch bitte mal den vollständigen HTML-Code, also auch den ausgegebenen PHP-Code, oder nenn den Link zur Seite, denn "mein" Codeschnipsel ist nur die korrigierte Fassung "deines" gezeigten Codeschnipsels.
 
Code:
<?php
	if(isset($_GET["ID"])) {
		$ID = $_GET["ID"];
	} else {
		$ID = 0;
	}
	$gb_entries = mysql_num_rows(mysql_query("SELECT * FROM gbentries"));
	$gbpic = mysql_fetch_array(mysql_query("SELECT * FROM gbpic"));
?>
<table border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td width="323" height="226" style="background-image: url('./images/gb/<?php echo $gbpic["gbpic"]; ?>'); background-repeat: no-repeat;"></td>
		<td valign="top" rowspan="6" style="padding-left: 35px; padding-top: 16px;">
			<?php
				if(!isset($_POST["gb_name"])) {
					require("./pages/gb/entries.php");
				} elseif((trim($_POST["gb_name"]) == "") OR (trim($_POST["gb_text"]) == "")) {
					$gb_out = 1;
			?>
					<span class="content">
						Beide Felder m&uuml;ssen ausgef&uuml;llt werden!
					</span>
			<?php
				} else {
					$add_entry = mysql_query("INSERT INTO gbentries (Name, Datum, Text) VALUES ('".$_POST["gb_name"]."', '".$current_date."', '".$_POST["gb_text"]."')");
					echo '<span class="content">Der Gästebucheintrag wurde erfolgreich hinzugefügt.</span>';
					$gb_out = 1;
				}
			?>
		</td>
	</tr>
	<tr>
		<td width="323" height="50"></td>
	</tr>
	<tr>
		<td width="323" style="padding-bottom: 4px;">
			<form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
				<?php
					if((!isset($_COOKIE["gb_sperre"])) AND (!isset($gb_sperre))) {
				?>
						<span class="heading">
							Name:&nbsp;</span><input type="text" class="gb_input" name="gb_name">

				<?php
					} else {
						echo '<span class="content">Sie dürfen nur alle 5 Minuten einen Gaestebucheintrag schreiben.</span>';
					}
				?>
		</td>
	</tr>
	<?php
					if((!isset($_COOKIE["gb_sperre"])) AND (!isset($gb_sperre))) {
	?>
	<tr>
		<td width="323" height="2" style="background-color: #474747;"></td>
	</tr>
	<?php
					}
	?>
	<tr>
		<td width="323" style="padding-top: 5px;">
				<?php
					if((!isset($_COOKIE["gb_sperre"])) AND (!isset($gb_sperre))) {
				?>
						<textarea class="gb_text" name="gb_text" cols="0" rows="0"></textarea>
				<?php
					}
				?>
		</td>
	</tr>
	<tr>
		<td valign="top" align="center" width="323" style="padding-top: 10px;">
				<?php
					if((!isset($_COOKIE["gb_sperre"])) AND (!isset($gb_sperre))) {
				?>
						<input type="submit" class="gb_submit" value="Eintragen">
				<?php
					}
				?>
			</form>
		</td>
	</tr>
</table>

oder auch:

http://creek.cr.funpic.de/index.php?page=gb
 
Notier das <form> ... </form>-Tag zu Beginn und am Ende der Tabelle:

Code:
<div align="left" style="width: 710px; height: 500px; margin-left: 0px;">
    <form name="gb_entry" action="index.php?page=gb" method="POST" style="margin: 0px; padding: 0px;">
        <table border="0" cellpadding="0" cellspacing="0">
            ...

                        <input type="submit" class="gb_submit" value="Eintragen">
                </td>
            </tr>
        </table>    
    </form>                                     
</div>
 
Status
Nicht offen für weitere Antworten.
Zurück