Jump to content

stathis

Members
  • Posts

    1
  • Joined

  • Last visited

stathis's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. Hello everyone. First of all let me start by saying that i'm not a coder but a website owner. I have this piece of code in my website that a hired coder did and used to work with older browsers but not any more. Old browsers meaning that it used to work with IE8 but not with current IE nor Chrome. So essentially what i was doing was when i selected a player from the dropdown list and pressed "Rename" button, i was presented with a popup windows to rename the player, and if a player with the same name existed to merge his stats. Now, when i press the "Rename" button the page refreshes without getting any popups and player is no longer in the list as if it was deleted from the database. Can anyone help me to solve this? I'm also attaching the whole file if it can be of any help. <FORM method=post action="admin_league.php?id=<?=$leagueid?>&s=<?= $seasonid ?>&rplayer=1" onSubmit="return renamePlayer()">Current Players: <SELECT name=currPlayer><OPTION value=0> <?php $r = mysql_query("SELECT id, name FROM players WHERE season=$seasonid ORDER BY name"); $names = array(); while (list($id, $name) = mysql_fetch_row($r)) { echo("<OPTION value=$id>$namen"); $names[] = preg_quote($name, "/"); } $regexp = "/^" . join("$|^", $names) . "$/";?></SELECT><INPUT type=hidden name="newPlayerName"><INPUT type=submit value="Rename"></FORM></DIV><SCRIPT language=javascript> var cpDropdown = document.getElementById('currPlayer'); var nnHidden = document.getElementById('newPlayerName'); function renamePlayer() { var cpOption = cpDropdown.options[cpDropdown.selectedIndex]; id=cpOption.value; oldname=cpOption.text; if (id==0) { alert("You must select a player to rename first."); return false; } newname = prompt("Please enter a new name for '"+oldname+"':", oldname); if (!newname || newname==oldname) { return false; } if (new String(newname).search(<?= $regexp ?>) != -1) { if (!confirm("The name "+newname+" already exists.nWould you like to combine "+oldname+"'s stats into "+newname+"'s?")) return false; } nnHidden.value = newname; return true; }</SCRIPT> admin_league.zip
×
×
  • Create New...