<html>
<head>
<script>
function addstafflist()
{
for(var i = 0; i < document.getElementById("stafflist").options.length; i++)
{
if(document.getElementById("stafflist").options[i].selected)
{
var staffname = document.getElementById("stafflist").options[i].text;
var selectedstaffnamelist = document.getElementById("selectedstafflist");
var found = false;
for(var j = 0; j < selectedstaffnamelist.length; j++)
{
if(selectedstaffnamelist[j].text == staffname)
{
found = true;
break;
}
}
if(!found)
{
var option = document.createElement("option");
option.text = staffname;
selectedstaffnamelist.add(option);
}
}
}
</script>
</head>
<body>
<form action="test2.php" method="post">
<table border="0" width="300" style="border-collpase:collapse">
<tr>
<td width="50">
<select id="stafflist" name="stafflist[]" style="width:70px;" multiple>
<option value="[email protected]">ali</option>
<option value="[email protected]">abu</option>
<option value="[email protected]">ahmad</option>
</select>
</td>
<td width="30">
<input type="button" name="add" value=">>" onclick="addstafflist()" />
</td>
<td>
<select id="selectedstafflist" name="selectedstafflist[]" style="width:70px;" multiple>
</select>
</td>
</tr>
<tr height="20">
<td colspan="3">
<input type="submit" name="submit" value="Show" />
</td>
</tr>
</table>
</form>
</body>
</html>
<?php
if(isset($_POST['submit']))
{
//[HERE]
}
?>
上記のコードから、ドロップダウンリストから「abu」を選択して「表示」ボタンをクリックすると、PHPを使用して電子メールアドレス([email protected]、abu @ gmail.com)の[ここ]セクションの[表示]ボタンをクリックしてください。誰か助けてくれますか?PHPを使用した表示名
あなたは、クライアント側とサーバー側の違いを学ぶ必要があります。 http://stackoverflow.com/a/13840431/3083093 – R3tep