Works for me without a DB, must be a problem with your db query.
To test it load your page with ?v=10 then ?v=1
PHP Code:
<tr class="alt2">
<td>GLENDOWER</td>
<td>27 FEBRUARY 2011</td>
<td>?</td>
<?php
// name of tournament you wish to count entries from
// maybe from a form entry?
//$tournament = 'GLENDOWER - 27/02/2011';
// count the total entries with that tournament name
//$c = mysql_query ("SELECT count(*) from `_Form_Nr_4` WHERE `I_wish_to_play` = '$tournament'");
// add these two lines here:
//$c = mysql_fetch_row($c);
//$c = $c[0];
$c = $_GET['v'];
// these lines take the result (a mysql resource)
// and turn it into an array - something we can actually use
// in php. The entry count is in the first index ( index 0 ).
$openORclosed = $c >= 10 ? 'Closed' : 'Open';
echo "<td>";
if ($openORclosed != 'Closed') {
?>
<form action="https://www.payfast.co.za/eng/process" method="post">
<input type="hidden" name="cmd" value="_paynow">
<input type="hidden" name="receiver" value="junior@hayesgolf.co.za">
<input type="hidden" name="item_name" value="Payment - Glendower - Glacier Series">
<input type="hidden" name="item_description" value="payment">
<input type="hidden" name="amount" value="120.00">
<input type="hidden" name="return_url" value="http://www.gnjgf.co.za/entryform.php">
<input type="hidden" name="cancel_url" value="http://www.gnjgf.co.za/Glacier_Main.html">
<input type="submit" style="width:66px;height:20px;background-color:#B5CCE4;font-size:10px; font-family: arial, sans-serif;" value="PAY NOW">
<?php
} else {
echo $openORclosed;
}
?>
</td>
</tr>
Corrections to my coding/thoughts welcome.
Bookmarks