Hello all,
I've been designing a web-site, and on one of my pages I have a form. And one it, there are 14 database-driven drop-down lists which featue the names of the players in my soccer team. The idea is that after every game, the match details are submitted, as well as the names of the players who played in the game.
Therefore, once the user has selected who played from the drop-down list, on the submission of the form, I want the data to be inserted into fourteen different rows in the database.
I've been using the very limiting PHP Login Suite plugin for Dreamweaver MX so far, therefore if there is any excess junk coce, that's why... I've tried to "edit" the code myself to see if changing it will work... but it doesn't. Any help would be appreciated so that form fields PlayerAdd1 through the Player PlayerAdd14 successfully populate the 14 rows in the DB... Thank you so much - if you can! 😕
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_insert"])) && ($HTTP_POST_VARS["MM_insert"] == "player")) {
$insertSQL = sprintf("INSERT INTO fixtureplayer (FixtureID, PlayerID, Appearance, SubAppearance) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['FixtureID1'], "int"),
GetSQLValueString($HTTP_POST_VARS['playeradd1'], "int"),
GetSQLValueString($HTTP_POST_VARS['Appearance1'], "int"),
GetSQLValueString($HTTP_POST_VARS['SubAppearance1'], "int"));
// the bit I added (without success)
$insertSQL = sprintf("INSERT INTO fixtureplayer (FixtureID, PlayerID, Appearance, SubAppearance) VALUES (%s, %s, %s, %s)",
GetSQLValueString($HTTP_POST_VARS['FixtureID2'], "int"),
GetSQLValueString($HTTP_POST_VARS['playeradd2'], "int"),
GetSQLValueString($HTTP_POST_VARS['Appearance2'], "int"),
GetSQLValueString($HTTP_POST_VARS['SubAppearance2'], "int"));
// end of the bit I added (without success)
mysql_select_db($database_connDB, $connDB);
$Result1 = mysql_query($insertSQL, $connDB) or die(mysql_error());
$insertGoTo = "match_detail2.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}