好的,我敢肯定很多人已经问过这个问题,但我还没有看到任何真正明确的答案。我需要捕获一个我已经有值的变量......这是我的例子:
<?php
$data_p = mysql_query("SELECT * FROM `dreams`") or die(mysql_error());
while($info = mysql_fetch_array( $data_p )) {
<table>
<tr>
<td><?php echo $info['first']; ?> <?php echo $info['last']; ?></td>
<td><?php echo $info['city']; ?> <?php echo $info['state']; ?></td>
<td><?php echo $info['dream']; ?></td>
<td>$<?php echo $info['donation_goal']; ?></td>
<td>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="2HGLK2WGELUNG">
****************<input type="hidden" name="dream_id" value="<?php echo $info['dream_id']; ?>">
<input type="image" src="images/donatebutton.png" id="donate" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</td>
</tr>
</table
}
这显示如下:
http://www.dreamsurreal.com/images/example.jpg
带有所有* *的行是我遇到麻烦的地方。
我在 paypal.com 中创建了按钮,但我自己添加了*行。
我需要将此变量传递给贝宝,以便当我的数据库通过 ipn.php 更新时。这里是 ipn.php 的 MYSQL 更新区:
// add this order to a table of completed orders
$payer_email = mysql_real_escape_string($_POST['payer_email']);
$mc_gross = mysql_real_escape_string($_POST['mc_gross']);
$dream_id = $_POST['dream_id'];
$sql = "INSERT INTO orders VALUES
(NULL, '$txn_id', '$payer_email', '$mc_gross', '$dream_id')";
但由于某种原因,即使我添加了 $dream_id = $_POST['dream_id'] 并且还将 $dream_id 添加到 mysql 插入的 INSERT 部分,它并没有插入实际变量,它只是使其为 0。
我希望我对每个人都足够清楚,我能否就如何使其正常工作获得一些帮助。