I am learning ionic3
I have some working code in php
The below code is working properly in html website.
````
<?php
function date_picker($name, $startyear=NULL, $endyear=NULL)
{
if($startyear==NULL) $startyear = date("Y")-2;
if($endyear==NULL) $endyear=date("Y");
$months=array('','January','February','March','April','May',
'June','July','August', 'September','October','November','December');
// Month dropdown
$html="<select name=\"".$name."month\">";
for($i=1;$i<=12;$i++)
{
$html.="<option ";
if (is_array($_POST) && array_key_exists('deathmonth', $_POST))
{
if ($i == $_POST['deathmonth'])
{
$html.="selected";
}
}
else
{
if($i == date('m')) $html.="selected";
}
$html.=" value='$i'>$months[$i]</option>";
}
$html.="</select> ";
// Day dropdown
$html.="<select name=\"".$name."day\">";
for($i=1;$i<=31;$i++)
{
$html.="<option ";
if (is_array($_POST) && array_key_exists('deathday', $_POST))
{
if ($i == $_POST['deathday'])
{
$html.="selected";
}
}
else
{
if($i == date('d')) $html.="selected";
}
$html.=" value='$i'>$i</option>";
}
$html.="</select> ";
// Year dropdown
$html.="<select name=\"".$name."year\">";
for($i=$startyear;$i<=$endyear;$i++)
{
$html.="<option ";
if (is_array($_POST) && array_key_exists('deathyear', $_POST))
{
if ($i == $_POST['deathyear'])
{
$html.="selected";
}
}
else
{
if($i == date('Y')) $html.="selected";
}
$html.=" value='$i'>$i</option>";
}
$html.="</select> ";
return $html;
}
?>
<span style="color: #00F">Select the date of death and click Get Dates</span>
<?php
echo date_picker("death");
?>
<input type="submit" name="submit" value="Get Dates"/>
</form>
<?php
if(count($_POST) > 1)
{
$datefield = $_POST['deathday'] . "-" . $_POST['deathmonth'] . "-" . $_POST['deathyear'];
echo '<span style="color: #00F">The date you have selected is : <b>' . $datefield . '</b></span><br>' . '</tr><tr><td>';
$date1 = date('d-m-Y', strtotime( $datefield . "+27 days")) . "<br>";
$date2 = date('d-m-Y', strtotime( $datefield . "+40 days")) . "<br>";
$date3 = date('d-m-Y', strtotime( $datefield . "+170 days")) . "<br>";
$date4 = date('d-m-Y', strtotime( $datefield . "+340 days")) . "<br>";
//date_add($date1, date_interval_create_from_date_string('27 days'));
//date_add($date2, date_interval_create_from_date_string('40 days'));
//date_add($date3, date_interval_create_from_date_string('170 days'));
//date_add($date4, date_interval_create_from_date_string('340 days'));
echo '<div style="font-family: Comic Sans MS; font-size:14px; color: #0000FF; ine-height:26px; background-color:#C6FFFF0;">';
echo "General Conditions : If possible avoid eldest kartha's jenma star, then Tuesday - Saturday - Friday (in this order)<hr>";
echo "27th Oonam : <b>" . $date1 . "</b><br>";
echo "We have given 28th day, it can be performed either on 28th or on 29th day. <br>";
echo "It can be performed on 30th day if thithi maasikam does not occur. <br><hr>";
echo "45th Oonam : <b>" . $date2 . "</b><br>";
echo "We have given 41st day, it can be performed on any one day from 41st to 45th day. <br><hr>";
echo "6th month Oonam : <b>" . $date3 . "</b><br>";
echo "We have given 171st day, it can be performed on any one day from 171st to 180th day. <br><hr>";
echo "Oona aapthikam : <b>" . $date4 . "</b><br>";
echo "We have given 341st day, it can be performed on any one day from 341st to 355th day. <br><hr>";
echo "General conditions are applicable for all the four oonams. <br>";
}
?>
I wish to use this code in my new ionic3 app
please help with ts and html to show up.
I tried many ways to do this and searched through google and I could not find a solution to do this. It is very difficult to post a question also here.