Formular Tipp eintragen

Migelinho

Mitglied
Ich möchte gern mehrere Felder auf einmal in meine MySQL DB eintragen. Mit einzelne Felder siehts gut aus aber der PHP Code wäre zu lang. Gib es eine Möglichkeit den Code zu kürzen? Der unterstehende Code betrifft nur 2 Felder. Es müsste doch einfacher gehen.

Zudem möchte ich gerne das Felder, welche bereits einmal vom User initialisiert wurden
und durch das Formular Submit an die DB gesendet wurden, nicht mehr veränderbar wären (grau hinterlegt). Gibt es da eine Möglichkeit?

Gruss und Danke im Voraus
Migelinho


PHP:
<?php require_once('Connections/conn_wm.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tipp (spieler_id, spielteams_id, goals) VALUES ($IDuser, '01a', %s)",
                       GetSQLValueString($_POST['01a'], "int"));

  mysql_select_db($database_conn_wm, $conn_wm);
  $Result1 = mysql_query($insertSQL, $conn_wm) or die(mysql_error());
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO tipp (spieler_id, spielteams_id, goals) VALUES ($IDuser, '01b', %s)",
                        GetSQLValueString($_POST['01b'], "int"));

  mysql_select_db($database_conn_wm, $conn_wm);
  $Result1 = mysql_query($insertSQL, $conn_wm) or die(mysql_error());
}
 

	// *** session ***
	require('connect.php');
	require('sessionfunctions.php');
	// *** end session ***
	
require_once('Connections/conn_wm.php'); ?>
 
Hier noch das unter dem PHP Code stehende HTML Code

HTML:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Tipp</title>
<link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen">


<style type="text/css">
<!-- 
 BODY { 
           scrollbar-base-color:#eeeeee; 
           scrollbar-track-color:#AD0021; 
           scrollbar-arrow-color:#bbbbbb; 
                   scrollbar-3dlight-color:#eeeeee; 
                   scrollbar-darkshadow-color: #eeeeee; 
                   scrollbar-highlight-color: #bbbbbb; 
                   scrollbar-shadow-color: #bbbbbb; 
                   scrollbar-face-color: #eeeeee;
           background-color: #AD0021;} 
//.Stil1 {color: #A3B2CC}
--> 
</style></head>

<body>
<form action="<?php echo $editFormAction; ?>" name="form1" method="POST">
<table width="600" border="0" cellpadding="0" cellspacing="2" bgcolor="#AD0021">
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">Frankreich : Senegal</div></td>
    <td height="25"><div align="center">
        <input name="01a" type="text" id="01a" size="3" maxlength="2">
      :
      <input name="01b" type="text" id="01b" size="3" maxlength="2">
    </div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">Uruguay : D&auml;nemark </div></td>
    <td height="25"><div align="center">
        <input name="02a" type="text" id="02a" size="3" maxlength="2">
    :
    <input name="02b" type="text" id="02b"  size="3" maxlength="2">
    </div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">Spanien : Slowenien </div></td>
    <td height="25"><div align="center">
      <input name="03a" type="text" id="03a" size="3" maxlength="2">
:
<input name="03b" type="text" id="03b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">Paraguay : S&uuml;dafrika </div></td>
    <td height="25"><div align="center">
      <input name="04a" type="text" id="04a" size="3" maxlength="2">
:
<input name="04b" type="text" id="04b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">Brasilien : T&uuml;rkei </div></td>
    <td height="25"><div align="center">
      <input name="05a" type="text" id="05a" size="3" maxlength="2">
:
<input name="05b" type="text" id="05b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">China : Costa Rica </div></td>
    <td height="25"><div align="center">
      <input name="06a" type="text" id="06a" size="3" maxlength="2">
:
<input name="06b" type="text" id="06b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">S&uuml;dkorea : Polen </div></td>
    <td height="25"><div align="center">
      <input name="07a" type="text" id="07a" size="3" maxlength="2">
:
<input name="07b" type="text" id="07b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">USA : Portugal </div></td>
    <td height="25"><div align="center">
      <input name="08a" type="text" id="08a" size="3" maxlength="2">
:
<input name="08b" type="text" id="08b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Deutschland : Saudi-Arabien</div></td>
    <td height="25"><div align="center">
      <input name="09a" type="text" id="09a" size="3" maxlength="2">
:
<input name="09b" type="text" id="09b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Irland : Kamerun </div></td>
    <td height="25"><div align="center">
      <input name="10a" type="text" id="10a" size="3" maxlength="2">
:
<input name="10b" type="text" id="10b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">Argentinien : Nigeria </div></td>
    <td height="25"><div align="center">
      <input name="11a" type="text" id="11a" size="3" maxlength="2">
:
<input name="11b" type="text" id="11b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">England : Schweden </div></td>
    <td height="25"><div align="center">
      <input name="12a" type="text" id="12a" size="3" maxlength="2">
:
<input name="12b" type="text" id="12b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Italien : Ecuador </div></td>
    <td height="25"><div align="center">
      <input name="13a" type="text" id="13a" size="3" maxlength="2">
:
<input name="13b" type="text" id="13b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Koratien : Mexico </div></td>
    <td height="25"><div align="center">
      <input name="14a" type="text" id="14a" size="3" maxlength="2">
:
<input name="14b" type="text" id="14b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Japan : Belgien </div></td>
    <td height="25"><div align="center">
      <input name="15a" type="text" id="15a" size="3" maxlength="2">
:
<input name="15b" type="text" id="15b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Russland : Tunesien </div></td>
    <td height="25"><div align="center">
      <input name="16a" type="text" id="16a" size="3" maxlength="2">
:
<input name="16b" type="text" id="16b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">Senegal : Uruguay </div></td>
    <td height="25"><div align="center">
      <input name="17a" type="text" id="17a" size="3" maxlength="2">
:
<input name="17b" type="text" id="17b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">D&auml;nemark : Frankreich </div></td>
    <td height="25"><div align="center">
      <input name="18a" type="text" id="18a" size="3" maxlength="2">
:
<input name="18b" type="text" id="18b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">Slowenien : Paraguay </div></td>
    <td height="25"><div align="center">
      <input name="19a" type="text" id="19a" size="3" maxlength="2">
:
<input name="19b" type="text" id="19b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">S&uuml;dafrika : Spanien </div></td>
    <td height="25"><div align="center">
      <input name="20a" type="text" id="20a" size="3" maxlength="2">
:
<input name="20b" type="text" id="20b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">T&uuml;rkei : China </div></td>
    <td height="25"><div align="center">
      <input name="21a" type="text" id="21a" size="3" maxlength="2">
:
<input name="21b" type="text" id="21b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">Costa Rica : Brasilien</div></td>
    <td height="25"><div align="center">
      <input name="22a" type="text" id="22a" size="3" maxlength="2">
:
<input name="22b" type="text" id="22b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">Polen : USA</div></td>
    <td height="25"><div align="center">
      <input name="23a" type="text" id="23a" size="3" maxlength="2">
:
<input name="23b" type="text" id="23b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">Portugal : S&uuml;dkorea </div></td>
    <td height="25"><div align="center">
      <input name="24a" type="text" id="24a" size="3" maxlength="2">
:
<input name="24b" type="text" id="24b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Saudi-Arab : Irland </div></td>
    <td height="25"><div align="center">
      <input name="25a" type="text" id="25a" size="3" maxlength="2">
:
<input name="25b" type="text" id="25b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Kamerun : Deutschland</div></td>
    <td height="25"><div align="center">
      <input name="26a" type="text" id="26a" size="3" maxlength="2">
:
<input name="26b" type="text" id="26b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">Nigeria : England </div></td>
    <td height="25"><div align="center">
      <input name="27a" type="text" id="27a" size="3" maxlength="2">
:
<input name="27b" type="text" id="27b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">Schweden : Argentinien </div></td>
    <td height="25"><div align="center">
      <input name="28a" type="text" id="28a" size="3" maxlength="2">
:
<input name="28b" type="text" id="28b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Ecuador : Kroatien </div></td>
    <td height="25"><div align="center">
      <input name="29a" type="text" id="29a" size="3" maxlength="2">
:
<input name="29b" type="text" id="29b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Mexico : Italien </div></td>
    <td height="25"><div align="center">
      <input name="30a" type="text" id="30a" size="3" maxlength="2">
:
<input name="30a" type="text" id="30a" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Belgien : Russland </div></td>
    <td height="25"><div align="center">
      <input name="31a" type="text" id="31a" size="3" maxlength="2">
:
<input name="31a" type="text" id="31a" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Tunesien : Japan </div></td>
    <td height="25"><div align="center">
      <input name="32a" type="text" id="32a" size="3" maxlength="2">
:
<input name="32b" type="text" id="32b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">D&auml;nemark : Senegal </div></td>
    <td height="25"><div align="center">
      <input name="33a" type="text" id="33a" size="3" maxlength="2">
:
<input name="33b" type="text" id="33b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">A</div></td>
    <td width="210" height="25"><div align="center">Uruguay : Frankreich</div></td>
    <td height="25"><div align="center">
      <input name="34a" type="text" id="34a" size="3" maxlength="2">
:
<input name="34b" type="text" id="34b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">S&uuml;dafrika : Slowenien </div></td>
    <td height="25"><div align="center">
      <input name="35a" type="text" id="35a" size="3" maxlength="2">
:
<input name="35b" type="text" id="35b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">B</div></td>
    <td width="210" height="25"><div align="center">Paraguay : Spanien </div></td>
    <td height="25"><div align="center">
      <input name="36a" type="text" id="36a" size="3" maxlength="2">
:
<input name="36b" type="text" id="36b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">Costa Rica : T&uuml;rkei </div></td>
    <td height="25"><div align="center">
      <input name="37a" type="text" id="37a" size="3" maxlength="2">
:
<input name="37b" type="text" id="37b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">C</div></td>
    <td width="210" height="25"><div align="center">China - Brasilien </div></td>
    <td height="25"><div align="center">
      <input name="38a" type="text" id="38a" size="3" maxlength="2">
:
<input name="38b" type="text" id="38b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">Portugal : Polen </div></td>
    <td height="25"><div align="center">
      <input name="39a" type="text" id="39a" size="3" maxlength="2">
:
<input name="39b" type="text" id="39b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">D</div></td>
    <td width="210" height="25"><div align="center">USA : S&uuml;dkorea </div></td>
    <td height="25"><div align="center">
      <input name="40a" type="text" id="40a" size="3" maxlength="2">
:
<input name="40b" type="text" id="40b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Kamerun : Saudi-Arabien</div></td>
    <td height="25"><div align="center">
      <input name="41a" type="text" id="41a" size="3" maxlength="2">
:
<input name="41b" type="text" id="41b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">E</div></td>
    <td width="210" height="25"><div align="center">Irland : Deutschland</div></td>
    <td height="25"><div align="center">
      <input name="42a" type="text" id="42a" size="3" maxlength="2">
:
<input name="42b" type="text" id="42b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">Schweden : Nigeria </div></td>
    <td height="25"><div align="center">
      <input name="43a" type="text" id="43a" size="3" maxlength="2">
:
<input name="43b" type="text" id="43b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">F</div></td>
    <td width="210" height="25"><div align="center">England : Argentinien </div></td>
    <td height="25"><div align="center">
      <input name="44a" type="text" id="44a" size="3" maxlength="2">
:
<input name="44b" type="text" id="44b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Mexico : Ecuador </div></td>
    <td height="25"><div align="center">
      <input name="45a" type="text" id="45a" size="3" maxlength="2">
:
<input name="45b" type="text" id="45b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">G</div></td>
    <td width="210" height="25"><div align="center">Kroatien : Italien </div></td>
    <td height="25"><div align="center">
      <input name="46a" type="text" id="46a" size="3" maxlength="2">
:
<input name="46b" type="text" id="46b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Tunesien : Belgien </div></td>
    <td height="25"><div align="center">
      <input name="47a" type="text" id="47a" size="3" maxlength="2">
:
<input name="47b" type="text" id="47b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
  </tr>
  <tr valign="middle" class="table_rangliste">
    <th width="120" height="25" scope="row">1.1.2006</th>
    <td width="45"><div align="center">H</div></td>
    <td width="210" height="25"><div align="center">Russland : Japan </div></td>
    <td height="25"><div align="center">
      <input name="48a" type="text" id="48a" size="3" maxlength="2">
:
<input name="48b" type="text" id="48b" size="3" maxlength="2">
</div></td>
    <td width="90" height="25"><div align="center">Vor WM </div></td>
</table>

<input type="hidden" name="MM_insert" value="form1">
</form>
</body>
</html>
 
Dafür musst du auf jeden Fall jeden Feldnamen, der eingetragen wird in ein Array packen! Danach kannst du ganz einfach für jedes Feld den Eintrag in die DB machen lassen! Und zwar mit einer foreach-Schleife:


PHP:
//$feldnamen ist das Array mit sämtlichen Feldnamen
foreach($feldnamen as $feldname){

    $insertSQL = sprintf("INSERT INTO tipp (spieler_id, spielteams_id, goals) VALUES ($IDuser, $feldname, %s)", 
                       GetSQLValueString($_POST[$feldname], "int")); 

  mysql_select_db($database_conn_wm, $conn_wm); 
  $Result1 = mysql_query($insertSQL, $conn_wm) or die(mysql_error());

}
 
Du kannst das Beispiel nehmen, welches ich oben angeführt hab! Nur musst du jedes Formularfeld so nennen:

PHP:
feldnamen[]

Wichtig hierbei sind die eckigen Klammern!
 
Zurück