Forum Moderators: coopster

Message Too Old, No Replies

Creating a form that once submitted displays a tabled output

Help with creating a form that queries the database

         

PRosales

10:22 am on May 6, 2005 (gmt 0)

10+ Year Member



PHP Gurus please help,

I have a form that I am trying to create that ideally will present a desired output based on the selections of the form.

The following is an example of the dataset I am pulling from:

I am trying to:

1. Have a drop-down selectable to select a start date.

2. Have another drop-down selectable to select a stop date.

3. Have radio buttons to select which datas I wish to view for the range set by steps 1 and 2. Example is nodes_available, nodes busy, one, both, or all.

4. Have the ability to select the interval of minute, hour, or day.

Once the form variables are selected, then it is submitted with the desired results displayed in a table on another page. Ideally this output will eventually find its output displayed in some type of graph form, but at the moment I am trying to atleast achieve the desired outcome.

Any help is appreciated,
Pete Rosales

[edited by: jatar_k at 3:23 pm (utc) on May 6, 2005]
[edit reason] removed url [/edit]

jatar_k

3:35 pm on May 6, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about these for a little help

Basics of extracting data from MySQL using PHP [webmasterworld.com]
Developing MySQL search query [webmasterworld.com]

there are some other threads in the PHP Library [webmasterworld.com] that might help as well

PRosales

4:07 pm on May 10, 2005 (gmt 0)

10+ Year Member



Thanks jatar k for the references, however, I am still unable to accomplish my task.

I have the following form that I wish to see the results for:

<?php

// Make a MySQL Connection

$sql = "SELECT DISTINCT FROM_UNIXTIME(insert_time, '%Y-%m-%d') as day FROM test_Nodes_Available_ACRL_Atlantis";

$result = mysql_query($sql) or die(mysql_error());

echo "<form action='result.php' name='myform'>";
echo "<select name='day_start'>";
echo "<option value=''>Select Day Start</option>";
while ($row = mysql_fetch_assoc($result)) {
echo "<option value='{$row['day']}'>{$row['day']}</option>";
}
echo "</select>";
echo "<select name='day_stop' onChange='submit()'>";
echo "<option value=''>Select Day Stop</option>";
while ($row = mysql_fetch_assoc($result)) {
echo "<option value='{$row['day']}'>{$row['day']}</option>";
}
echo "</select>";
echo "</form>";
?>

I am trying to have the Day Stop display the same selections as the Day Start, but to no avail. Once selections are made, the results page ideally will display the time range selected.

Please help, I really need some guidance.

Thanks,
Pete Rosales