Use two tables, one for storing university names that are 'known', and one for storing each user's choice (assuming you are going to be storing each user's choice).
Table 1 would have a university ID and the university's name.
Table 2 would have a field for the university's ID alongside the other data you're storing for each user.
Something like this:
PHP Code:
<?php
mysql_connect('localhost', 'username', 'password');
mysql_select_db('mydatabase');
if ($_REQUEST['cmd'] == 'list') {
echo '<form method="post" action="'.$_SERVER['PHP_SELF'].'">'."\n";
echo '<input type="hidden" name="cmd" value="update" />'."\n";
echo '<table border="0" cellpadding="0" cellspacing="0">'."\n";
echo '<tr><td>Choose a university, or enter your own.</td></tr>'."\n";
echo "<tr><td>\n";
echo 'Choose: <select name="universityid">'."\n";
$all = mysql_query("SELECT * FROM university ORDER BY name");
while ($uni = mysql_fetch_array($all)) {
echo '<option value="'.$uni['universityid'].'">'.$uni['name'].'</option>'."\n";
}
echo "</select><br />\n";
echo 'Or enter your own: <input type="text" name="other" value="" size="30" />'."\n";
echo "</td></tr>\n<td><tr>\n";
echo '<input type="submit" name="submit" value="Submit" />'."\n";
echo "</table>\n</form>";
}
if ($_POST['cmd'] == 'update') {
if (!empty($_POST['other'])) {
mysql_query("INSERT INTO university SET name = '".addslashes($_POST['other'])."'");
$id = mysql_insert_id();
} else {
$id = intval($_POST['universityid']);
}
mysql_query("INSERT INTO userchoice SET universityid = $id");
}
mysql_close();
?>
Obviously this is simplified but you get the idea.