我想要完成的只是允许用户从下拉列表中选择他们的用户名,然后选择他们想要使用该帐户购买的物品。一个问题是,当单击 PayPal 按钮时,用户名未存储在自定义字段中,但交易顺利进行。
支付宝按钮代码:
// Get information from database
$result = mysql_query("SELECT username FROM account WHERE mainusername='".$username."'");
while($row = mysql_fetch_array($result)) {
echo "<option>".$row['username']."</option>";
}
?>
</select>
</tr>
</td>
<tr>
<td>
<input type="hidden" name="on0" value="itemforsale">
<select name="os0">
<option value="shirt">shirt $5.55 USD</option>
<option value="short">short $31.55 USD</option>
<option value="skirt">skirt $62.75 USD</option>
</select>
</td>
</tr>
</table>
<br />
<input type="hidden" name="custom" value="
<?php
if(isset($_POST['getusername'])) {
$getusername = $_POST['getusername'];
echo "".$getusername."";
}
?>
">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>