我甚至不知道怎么谷歌这一个...想象它是什么傻事......但任何帮助将是巨大的......
提交表单时传递变量。 ..when呼应$ _ POST这是件好事......但是当我把它变成一个PHP变量它被复制
<?
//list transactions by month
if ($_POST['m']=="yes"){
$table = $_POST['month'];
$_SESSION['table']=$_POST['month'];
$conn = mysql_connect("localhost", "mss_records", "3205") or die(mysql_error());
mysql_select_db('store_records', $conn) or die(mysql_error());
$result = mysql_query("SELECT * FROM $table");
while($row = mysql_fetch_array($result))
{
$id=$row['transaction'];
$date=$row['date'];
$time=$row['time'];
$paid=$row['payment'];
$total=$row['total'];
echo '<style type="text/css">
<!--
.list {
font-family: Georgia, "Times New Roman", Times, serif;
font-size: 12px;
color: #000;
padding: 2px;
border: 2px solid #009;
}
.view {
width: 100px;
}
-->
</style>
<div class="list">
<p><span style="color: #900">Transaction #</span>'.$id.'
<span style="color: #900">Date:</span>'.$date.'
<span style="color: #900">Time:</span>'.$time.'<span style="color: #900">
Paid By:</span>'.$paid.' <span style="color: #900">Total:</span>'
.number_format($total, 2).'
<form name="form1" method="post" action="find.php">
<label>
<input type="submit" name="view" id="view" value="'.$id.'">
</label>
</form>
</p>
</div>
<p></p>';
}
}
//view transaction after viewing by month
if (isset($_POST['view'])){
$conn = mysql_connect("localhost", "mss_records", "3205") or die(mysql_error());
mysql_select_db('store_records', $conn) or die(mysql_error());
$table = $_SESSION['table'];
echo "this is the number ".$_POST['view'];
$post=$_POST['view'];
echo "this is the post ".$post;
$result = mysql_query("SELECT * FROM $table WHERE transaction = '$post'")
or die(mysql_error());
while($row = mysql_fetch_array($result))
{
$items=$row['transaction'];
}
echo $items;
}
?>
用户经过第一选择和第二窗口的输出是后.. 。
this is the number 46this is the $post 4646
考虑作出的[SSCCE(http://sscce.org/),所以我们可以更清楚地发现你的错误 – Jon 2012-03-13 00:53:23
Ι不认为这是与复制相关如你所说$ post变量。我认为最后一个echo $ items;声明打印46这样你可以获得4646当脚本终止。尝试注释脚本中的最后一个回显。 – Andreas 2012-03-13 00:54:37