I have a form that will post to multiple fields, but I have one (city) that needs to post to two fields within a table (thID, and city). One with an integer in ‘thID’ and the other with text under ‘city’.
<select name="city" class="formhead" id="city">
<?php
do {
?>
<option value="<?php echo $row_getCity['thID']?>"><?php echo $row_getCity['teamHeading']?></option>
<?php
} while ($row_getCity = mysql_fetch_assoc($getCity));
$rows = mysql_num_rows($getCity);
if($rows > 0) {
mysql_data_seek($getCity, 0);
$row_getCity = mysql_fetch_assoc($getCity);
}
?>
</select>
I thought by modifying the INSERT command thusly would do the job:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO team (teamID, thID, teamName, password, teamLeader, leaderPhone, leaderAddress, leaderEmail, website, member1, member2, member3, member4, access, city) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['teamID'], int"), GetSQLValueString($_POST['thID'], "int"),
GetSQLValueString($_POST['teamName'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['teamLeader'], "text"),
GetSQLValueString($_POST['leaderPhone'], "text"),
GetSQLValueString($_POST['leaderAddress'], "text"),
GetSQLValueString($_POST['leaderEmail'], "text"),
GetSQLValueString($_POST['website'], "text"),
GetSQLValueString($_POST['member1'], "text"),
GetSQLValueString($_POST['member2'], "text"),
GetSQLValueString($_POST['member3'], "text"),
GetSQLValueString($_POST['member4'], "text"),
GetSQLValueString($_POST['access'], "text"),
GetSQLValueString($_POST['city'], "text"));
Instead, I receive the following error:
Notice: Undefined index: thID in C:\htdocs\daretospare\register.php on line 62
line 62 is: GetSQLValueString($_POST[‘thID’], “int”),
The dbase table looks like this:
teamID (mediumint)
thID (int)
teamName (varchar)
password (varchar)
teamLeader (varchar)
leaderPhone (varchar)
leaderAddress (varchar)
leaderEmail (varchar)
website (varchar)
member1 (varchar)
member2 (varchar)
member3 (varchar)
member4 (varchar)
access (varchar)
city (varchar)
can this be done?