使网站ID增加1

时间:2013-10-15 01:38:10

标签: php forms auto-increment increment

嘿伙计我正在尝试进行测验,目前我遇到了一个问题,我已经让它增加但不发送数据,所以我需要修复它但不知道如何,我需要用户能够选择数据发送到下一页的选项,但页面也必须增加。 这就是我所拥有的

<form name="form2" method="post" >
<select name="answer">
<option value=$myrow['A']><?php echo $myrow['A']?></option>
<option value=$myrow['B']><?php echo $myrow['B']?></option>
<option value=$myrow['C']><?php echo $myrow['C']?></option>
<option value=$myrow['D']><?php echo $myrow['D']?></option>

 <input type="submit" name="submit" value="Continue" onclick = "window.location.href = 'testttts.php?id=<?php echo $count?>'"

任何帮助都会非常感谢!!

1 个答案:

答案 0 :(得分:1)

这是你的意思吗?

<?php

if(isset($_POST['i'])) {
    $i = $_POST['i'];
} else {
    $i = 0;
}

echo "increment: " . $i;
$i++;
?>

<form name="form2" method="post" >
<select name="answer">
<option value=$myrow['A']><?php echo $myrow['A']?></option>
<option value=$myrow['B']><?php echo $myrow['B']?></option>
<option value=$myrow['C']><?php echo $myrow['C']?></option>
<option value=$myrow['D']><?php echo $myrow['D']?></option>
</select>
<input type="hidden" name="i" value="<?php echo $i; ?>" />

<input type="submit" name="submit" value="Continue" />