I am quite a newbie to php, but this is a project I have to finish, it's quite hard for me because of my nearly zero experience with php.
What I want is to make a page where people can enter their username, if their username exists they will be taken to the paypal page [the username will be sent aswell], there they can enter a random donation value, log into their account, complete the transaction, after that paypal should send the username and the donation value back and trigger a script which would make a few querries and display the user together with his donation amount on a webpage.
The part I am stuck at is the "check username" one.
I created a form:
<form action="payment.php" method="post"
onsubmit="return CheckForm();">
Your Exact Account Name:<br>
<input name="accountID" type="text">
<input type="hidden" name="SubmitCheck" value="sent">
<input type="Submit" name="Form1_Submit" value="Login" />
</form>
And from modifying the paypal instant payment notification script i found here http://www.web-bureau.com/modules/free-php-paypal-ipn-script.php
I got this:
if (isset($_POST['SubmitCheck'])) {
$db = mysql_connect("localhost", "-----", "*******");
mysql_select_db("++++",$db);
$qry= "SELECT username FROM users WHERE username='".$_POST['accountID']."';";
$result = mysql_query($qry,$db);
if ($result==0)
{
echo '<font face="Arial" size="2"><br>You have entered a non existing user name.(1)<br>';
}
else
{
echo 'Send stuff to paypal'; //Not quite sure how to do that eihter.
}
mysql_close($db);
}
else {
echo '<font face="Arial" size="2"><br>You have entered a non existing account name.(2)<br>';
}
echo '</span>';
Now the problem is that no mather what I enter in the accountID form, be it an existing account or some random text I will always end up getting "Send stuff to paypal".