Hi all,
Just checking to see if I’ve missed anything.
My client wants to charge a registration fee to create a database record for new potential students. She wants to refund the registration fee (only once) if a student signs up and pays for a class.
Here’s the logic I’m using:
1) When the parent of a potential student wants to register, they first pay a small registration fee. On submission of the application, a checkbox in the accounts database called “refund registration fee” is automatically set to ‘1"
2) When a parent goes to the pay tuition (through paypal) page, if the refund_registration_fee” checkbox =1, the tuition fee reflects the refund.
3) The parent is automatically redirected to a thank you page.
When the thank you page loads, if value of the refund registration fee field value is “0", the field is automatically reset to “0"
I’m using the following code after the record calls at the top of the viewer to accomplish step 3, but wanted to ask if anyone found something that ought to be changed before I take the page live.
Thanks for looking,
Jerry Kornbluth
<?php if ($CURRENT_USER ['registration_fee_refund'] == 1): ?>
<?php mysqlStrictMode(false);
$query = "UPDATE `{$TABLE_PREFIX}accounts` SET
registration_fee_refund = 0
WHERE num = '".mysql_escape( $CURRENT_USER['num'] )."'";
mysql_query($query) or die("MySQL Error:<br/>\n". htmlspecialchars(mysql_error()) . "\n");
$userNum = mysql_insert_id();
?>
<?php endif ?>
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php