<?php
$user_name = "root";
$password = "";
$database = "words";
$server = "127.0.0.1";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
$randWordDesc = mysql_query("SELECT * FROM words ORDER BY RAND() LIMIT 1");
$db_field = mysql_fetch_assoc($randWordDesc);
if (isset($_POST['new'])) {
$unaltered = $db_field['noun'];
$lower=strtolower($unaltered);
$stepsinchain = array($lower);
if (isset($_POST['A'])) {
$subo = str_replace("o", "A", end($stepsinchain));
$stepsinchain[] = $subo;
}
if (isset($_POST['E'])) {
$subi = str_replace("i", "E", end($stepsinchain));
$stepsinchain[] = $subi;
}
}
?>
<form action="http://localhost/subsite/subletter.php" method="post" >
<input type="checkbox" name="A"> A for o
<input type="checkbox" name="E"> E for i
<br><br>
<input type="submit" name="new" value = "new" >
</form>
我有一些代码会从我的SQL数据库中随机检查一下随机字。 但在我拉出这个词之后,我希望能够有另一个选项来检查一些方框,按回车键,同样的单词会返回我检查的替换,而不是仅仅生成带有检查替换的另一个随机单词。 为此,我认为我需要存储原始随机查询,然后对其进行编辑。这是要走的路吗?这样做的最佳方式是什么?