| | |
Date list
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
Hi I am a newbe to php and I need to have the Dates on the list passed on to the two input values (Example Datefrom-Date list option - Dateto-Date list option) I am clueless on how to do this Thanks
see code below
<form id="form3" name="form3" action="">
<select name="SelectDate" id="SelectDate">
<option>Current Year</option>
<option>Current Year-to-date</option>
<option>Yesterday</option>
<option>Last Week</option>
<option>Last Week-to-date</option>
<option>Last Month</option>
<option>Last Month-to-date</option>
<option>Last Year</option>
<option>Last Year-to-date</option>
<option>Today</option>
<option>Current Month</option>
<option>Current Quarter</option>
<option>Current Quarter-to-date</option>
<option>All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input type="submit" name="button2" id="button2" value="New date" />
</form>
see code below
<form id="form3" name="form3" action="">
<select name="SelectDate" id="SelectDate">
<option>Current Year</option>
<option>Current Year-to-date</option>
<option>Yesterday</option>
<option>Last Week</option>
<option>Last Week-to-date</option>
<option>Last Month</option>
<option>Last Month-to-date</option>
<option>Last Year</option>
<option>Last Year-to-date</option>
<option>Today</option>
<option>Current Month</option>
<option>Current Quarter</option>
<option>Current Quarter-to-date</option>
<option>All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input type="submit" name="button2" id="button2" value="New date" />
</form>
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
I have tried with this and I am lost, I want to populate 2 Text field with dates (Datefrom and Dateto)
<?php
$SelectDate=$_GET['SelectDate'];
switch ($SelectDate)
{
case "Current Year":
$CurrentYear="selected";
break;
case "Current Year-to-date":
$CurrentYearTD="selected";
break;
case "Yesterday":
$Yesderday="selected";
break;
case "Last Week":
$LastWeek="selected";
break;
case "Last Week-to-date":
$LastWeekTD="selected";
break;
case "Last Month":
$LastMonth="selected";
break;
case "Last Month-to-date":
$LastMonthTD="selected";
break;
case "Last Year":
$LastYear="selected";
break;
case "Last Year-to-date":
$LastYearTD="selected";
break;
case "Today":
$Today="selected";
break;
case "Current Month":
$CurrentMonth="selected";
break;
case "Current Quarter":
$CurrentQuarter="selected";
break;
case "Current Quarter-to-date":
$CurrentQuarterTD="selected";
break;
case "All Dates":
$AllDates="selected";
break;
}
?>
<form id="form3" name="form3" action="">
<select name="SelectDate" id="SelectDate">
<option value="">Current Year</option>
<option value="">Current Year-to-date</option>
<option value="">Yesterday</option>
<option value="">Last Week</option>
<option value="">Last Week-to-date</option>
<option value="">Last Month</option>
<option value="">Last Month-to-date</option>
<option value="">Last Year</option>
<option value="">Last Year-to-date</option>
<option value="">Today</option>
<option value="">Current Month</option>
<option value="">Current Quarter</option>
<option value="">Current Quarter-to-date</option>
<option value="">All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input type="submit" name="button2" id="button2" value="New date" />
</form>
<?php
$SelectDate=$_GET['SelectDate'];
switch ($SelectDate)
{
case "Current Year":
$CurrentYear="selected";
break;
case "Current Year-to-date":
$CurrentYearTD="selected";
break;
case "Yesterday":
$Yesderday="selected";
break;
case "Last Week":
$LastWeek="selected";
break;
case "Last Week-to-date":
$LastWeekTD="selected";
break;
case "Last Month":
$LastMonth="selected";
break;
case "Last Month-to-date":
$LastMonthTD="selected";
break;
case "Last Year":
$LastYear="selected";
break;
case "Last Year-to-date":
$LastYearTD="selected";
break;
case "Today":
$Today="selected";
break;
case "Current Month":
$CurrentMonth="selected";
break;
case "Current Quarter":
$CurrentQuarter="selected";
break;
case "Current Quarter-to-date":
$CurrentQuarterTD="selected";
break;
case "All Dates":
$AllDates="selected";
break;
}
?>
<form id="form3" name="form3" action="">
<select name="SelectDate" id="SelectDate">
<option value="">Current Year</option>
<option value="">Current Year-to-date</option>
<option value="">Yesterday</option>
<option value="">Last Week</option>
<option value="">Last Week-to-date</option>
<option value="">Last Month</option>
<option value="">Last Month-to-date</option>
<option value="">Last Year</option>
<option value="">Last Year-to-date</option>
<option value="">Today</option>
<option value="">Current Month</option>
<option value="">Current Quarter</option>
<option value="">Current Quarter-to-date</option>
<option value="">All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input type="submit" name="button2" id="button2" value="New date" />
</form>
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
I have decided this way is better how do I populate the 2 text fields with dates
thanks
[QUOTE=lotpb;700178]I have tried with this and I am lost, I want to populate 2 Text field with dates (Datefrom and Dateto)
<?php
$country=$_REQUEST['SelectDate'];
switch($country)
{
case "1" :
echo "USD";
break;
case "2" :
echo "GBP";
break;
case "3" :
echo "NPR";
break;
case "4" :
echo "USD";
break;
case "5" :
echo "GBP";
break;
case "6" :
echo "NPR";
break;
case "7" :
echo "USD";
break;
case "8" :
echo "GBP";
break;
case "9" :
echo "NPR";
break;
case "10" :
echo "USD";
break;
case "11" :
echo "GBP";
break;
case "12" :
echo "NPR";
break;
case "13" :
echo "GBP";
break;
case "14" :
echo "NPR";
break;
}
?>
<form action="" name="form3" id="form3">
<select name="SelectDate" id="SelectDate" onchange="">
<option value="1">Current Year</option>
<option value="2">Current Year-to-date</option>
<option value="3">Yesterday</option>
<option value="4">Last Week</option>
<option value="5">Last Week-to-date</option>
<option value="6">Last Month</option>
<option value="7">Last Month-to-date</option>
<option value="8">Last Year</option>
<option value="9">Last Year-to-date</option>
<option value="10">Today</option>
<option value="11">Current Month</option>
<option value="12">Current Quarter</option>
<option value="13">Current Quarter-to-date</option>
<option value="14">All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input name="Datenow" type="hidden" id="Datenow" value="<?php echo date("Y-m-d"); ?>" size="10"/>
<input type="submit" name="button2" id="button2" value="New date" />
</form>
thanks
[QUOTE=lotpb;700178]I have tried with this and I am lost, I want to populate 2 Text field with dates (Datefrom and Dateto)
<?php
$country=$_REQUEST['SelectDate'];
switch($country)
{
case "1" :
echo "USD";
break;
case "2" :
echo "GBP";
break;
case "3" :
echo "NPR";
break;
case "4" :
echo "USD";
break;
case "5" :
echo "GBP";
break;
case "6" :
echo "NPR";
break;
case "7" :
echo "USD";
break;
case "8" :
echo "GBP";
break;
case "9" :
echo "NPR";
break;
case "10" :
echo "USD";
break;
case "11" :
echo "GBP";
break;
case "12" :
echo "NPR";
break;
case "13" :
echo "GBP";
break;
case "14" :
echo "NPR";
break;
}
?>
<form action="" name="form3" id="form3">
<select name="SelectDate" id="SelectDate" onchange="">
<option value="1">Current Year</option>
<option value="2">Current Year-to-date</option>
<option value="3">Yesterday</option>
<option value="4">Last Week</option>
<option value="5">Last Week-to-date</option>
<option value="6">Last Month</option>
<option value="7">Last Month-to-date</option>
<option value="8">Last Year</option>
<option value="9">Last Year-to-date</option>
<option value="10">Today</option>
<option value="11">Current Month</option>
<option value="12">Current Quarter</option>
<option value="13">Current Quarter-to-date</option>
<option value="14">All Dates</option>
</select>
from
<input name="Datefrom" type="text" id="Datefrom" value="<?php echo date("Y-01-01"); ?>" size="10" />
to
<input name="Dateto" type="text" id="Dateto" value="<?php echo date("Y-12-31"); ?>" size="10" />
<input name="Datenow" type="hidden" id="Datenow" value="<?php echo date("Y-m-d"); ?>" size="10"/>
<input type="submit" name="button2" id="button2" value="New date" />
</form>
![]() |
Similar Threads
- Increment filenumber with date (C++)
- Date functions (PHP)
- My HiJackThis Log (Viruses, Spyware and other Nasties)
- adware.mainsearch - how do you get rid of it? (Viruses, Spyware and other Nasties)
- Trojan.Bookmarker.gen/about:blank (Viruses, Spyware and other Nasties)
- www.lookfor.cc search still buggin me (Viruses, Spyware and other Nasties)
- Linked List using pointers (C++ ADT) (C++)
- date difference in c++ (C++)
- Event List for Car Show Fan Site - (PHP)
- Stay Up to Date Automatically (Windows tips 'n' tweaks)
Other Threads in the PHP Forum
- Previous Thread: append/write data from a text file into an excel sheet without using database
- Next Thread: How to display online users
| Thread Tools | Search this Thread |
advanced apache api array basics beginner binary broken cakephp check checkbox class cms code combobox cookies cron curl database date datepart display dynamic echo email error file files folder form forms function functions google head href htaccess html image include includingmysecondfileinthechain insert ip javascript job joomla js limit link login mail menu mlm mobile multiple mysql oop outofmemmory paging parse password paypal pdf php problem procedure query radio random recursion regex remote script search server sessions smarty sms soap source space sql stored syntax system table traffic tutorial unicode up-to-date update upload url validator variable video web webapplications xml youtube





