Plz help -creatin a report module
Posted: Wed Dec 14, 2005 11:43 am
Jcart | Please use
Jcart | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hello
I am new in php and i want to ask you something
I want to create a script that the admin will choose a date e.x 12 December 2005
and click sumbit and show him the result only for 12 december 2005
I have created the arrays for day month and year and i want now someone to help me how i can add the things that i told you before.
i have uploaded the script at http://www.greekfrape.com/mod_report.php
This is the code that i have written :Code: Select all
?><html>
<head>
<title></title>
</head>
<body>
<?php
/* Program name: report.php
* Description: Program displays a selection list that
* customers can use to select a date.
*/
$link = mysql_connect("mysql_host", "mysql_login", "mysql_password")
or die ("Could not connect to MySQL");
mysql_select_db ("my_database")
or die ("Could not select database");
echo "<html>
<head><title>Select a date</title></head>
<body>";
/* create an array of months*/
$monthName = array(1=> "January", "February", "March",
"April", "May", "June", "July",
"August", "September", "October",
"November", "December");
$today = time(); //stores today's date
$f_today = date("M-d-Y",$today); //formats today's date
echo "<div align='center'>\n";
/* display today's date */
echo "<p> <h3>Today is $f_today</h3><hr>\n";
/* create form containing date selection list */
echo "<form action='processform.php' method='POST'>\n";
/* build selection list for the month */
$todayMO = date("m",$today); //get the month from $today
echo "<select name='dateMO'>\n";
for ($n=1;$n<=12;$n++)
{
echo "<option value=$n\n";
if ($todayMO == $n)
{
echo " selected";
}
echo "> $monthName[$n]\n";
}
echo "</select>";
/* build selection list for the day */
$todayDay= date("d",$today); //get the day from $today
echo "<select name='dateDay'>\n";
for ($n=1;$n<=31;$n++)
{
echo " <option value=$n";
if ($todayDay == $n )
{
echo " selected";
}
echo "> $n\n";
}
echo "</select>\n";
/* build selection list for the year */
$startYr = date("Y", $today); //get the year from $today
echo "<select name='dateYr'>\n";
for ($n=$startYr;$n<=$startYr+1;$n++)
{
echo " <option value=$n";
if ($startYr == $n )
{
echo " selected";
}
echo "> $n\n";
}
echo "</select>\n";
echo "</form>\n";
?>
</body>
</html>Code: Select all
andCode: Select all
tags where appropriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]