Page 1 of 1
Function DropdownList -Please Help Me
Posted: Sun Aug 09, 2009 4:46 am
by azri_bech
I'm new php programmer
Query Form: using dropdownlist, the value consist:
<select>
<option value="today">Today</option>
<option value="LastWeek">Last week</option>
<option value="LastMonth">Last Month </option>
<select>
how to build the function and how the function can call the value to display the result.
Please help to resolve my problems.
Thank You,
Re: Function DropdownList -Please Help Me
Posted: Sun Aug 09, 2009 7:19 pm
by azri_bech
when user select date range from dropdownlist,
the result will be display on the query form.
Re: Function DropdownList -Please Help Me
Posted: Sun Aug 09, 2009 7:42 pm
by aceconcepts
If you can determine an initial date i.e. today then you can use mktime() to get past and future dates/times etc...
Take a look at
http://us.php.net/manual/en/function.mktime.php
Re: Function DropdownList -Please Help Me
Posted: Sun Aug 09, 2009 7:48 pm
by azri_bech
i dont know how to build the function. can you help me how to build a simple function to display the result when user select from dropdownlist..Thanks
Re: Function DropdownList -Please Help Me
Posted: Mon Aug 10, 2009 1:17 am
by cpetercarter
You need to do some reading on how php forms work.
You display a form on a page. The user choses from the drop-down menu, and then clicks "submit". The user's browser sends the chosen value to the server as a $_POST value. The server can then send a new web page back to the browser which displays the chosen value.
Like this script, which you can run as test.php:
Code: Select all
<?php
if (!isset($_POST['time'])) {
echo '<form action="test.php" method="post" enctype="multipart/form-data">';
echo '<select name="time">';
echo '<option value="today">Today</option>';
echo '<option value="LastWeek">Last week</option>';
echo '<option value="LastMonth">Last Month </option>';
echo '</select>';
echo '<input type="submit" value="submit" />';
echo '</form>';
} else {
echo "The value you chose was ".$_POST['time'];
}
?>
Re: Function DropdownList -Please Help Me
Posted: Mon Aug 10, 2009 2:21 am
by azri_bech
Thank you so much
