循环遍历数组onsubmit

时间:2013-08-26 15:18:12

标签: php html forms

我想遍历一个数组,这样每次提交表单时,数组中的字符都会递增,以便世界上的每个人都会收到一个字符,该字符从之前使用过该表单的人那里开始递增。怎么办?

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
var i = 0;
</script>
<form action="index.php" method="post">
Country:
<select name="country">
<option value="A">America</option>
<option value="B">Germany</option>
<option value="C">Greece</option>
<option value="D">Russia</option>
<option value="E">UK</option>
</select><br>
Postcode:
<input type="text" name="postcode">
<input type="submit">
</form><br>
Your number is:
<?php
$place = array("T", "U", "V", "W", "X", "Y", "Z");
$person = "number";
$i = 0;
echo $_POST["country"] . $_POST["postcode"] . $place[$i] . $person; 
?>
</body>
</html>

0 个答案:

没有答案