Got myself into a bit of a pickle attempting to send over a custom variable to paypal when the button is clicked
I'm currently adamant that this is the problem I'm having and why the transactions aren't executing correctly
So here's my code:
<?php
$check = $mysqli->query("SELECT is_member FROM users WHERE username = '$username'");
$row = $check->fetch_assoc();
$isMember = $row['is_member'];
if ($isMember == 0){
echo'
<p>To gain access to the members section and receive daily horse racing tips from our professionals purchase premium membership</a></p>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="custom" value="$id;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="CVWJZN5AALBVJ">
<input type="image" src="https://www.sandbox.paypal.com/en_US/GB/i/btn/btn_subscribeCC_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_GB/i/scr/pixel.gif" width="1" height="1">
</form>
';
}else{
echo'<p> You are a member, <a href="membership.php">click here</a> to access the membership page </p>';
}
?>
The problem I'm having is this line:
<input type="hidden" name="custom" value="$id;">
Sending the ID of the user to paypal. I know how to do this normally, but because I'm already echoing out the form I don't believe I need to use new php tags to echo out the variable
I have tried many different ways of passing it, just want to get the correct one!