I have the following code which connects to a database and sets the
value of counter to '0' and the date to be either the current date or a
users own date. The database connects via an included script as this is
a contribution for OSCommerce. Each section (the set date today and set
date custom) works fine by itself (with the other half commented out)
but I cant make it so the option is available via radio buttons, what am
I doing wrong?
Thanks in advance,
Ben
P.S. This is the code I am using
<?php
include('includes/application_top.php');
?>
<html>
<body>
<?php
//OS Commerce Counter Reset v0.15
//Author: Ben Allen
if ($submit) {
//Validation
$flag="OK"; // This is the flag and we set it to OK
$msg=""; // Initializing the message to hold the error messages
//Set Query Variables
$query = "UPDATE counter SET counter = 0";
$today = date("Ymd");
$datetoday = "UPDATE counter SET startdate = $today";
//Set Date=Today
if ($setdate="true") {
$counterquery = mysql_query($query);
$datequery = mysql_query($datetoday);
echo "Counter Reset Succesfully";
}else{
//Set Date Custom
if ($setdate="false") {
//Edit Database:
$customdate = mktime(0, 0, 0, $month, $day, $year);
$datecustom = strftime("%Y%m%d", $customdate);
$datecustomquery = "UPDATE counter SET startdate = $datecustom";
$counterquery = mysql_query($query);
$datecustomresult = mysql_query($datecustomquery);
echo "Counter Reset Succesfully";
}
}else {
//Display Form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table width="260" border="0" align="center" height="90"> <tr
align="center" valign="middle">
<td height="31"> <div align="right" class="content">
<div align="left">
<input name="setdate" type="radio" value="true">
Today</div>
</div>
<div align="left"> </div></td></tr>
<tr align="center" valign="middle"> <td height="25"> <div
align="right"><font color="FBC300"></font></div>
<div align="left"><font color="FBC300">
<input name="setdate" type="radio" value="false">
</font>
<input name="day" type="text" id="day" size="2" maxlength="2">
<input name="month" type="text" id="month" size="2"
maxlength="2">
<input name="year" type="text" id="year" size="4" maxlength="4">
(dd/mm/yyyy) </div></td></tr> <tr align="center"
valign="middle"> <td> <div align="center">
<input type="Submit" name="submit" value="Enter" class="button"> </div>
<div align="center"></div></td></tr> </table>
<font color="FBC300"> </font></form>
<?php
} // end if
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
</body>
</html>