0

hi friends,

In my project, want to display data from Mysql between two date. Date was given by user only, according to that it take info from database,


And important things is display the retrieve information through table,

My Html coding :

<body>
<form method="post" action="reportviewinfo.php">
<label>From Time : </label><input type="text" name="from" /><br/><br/>
<label>To Time   : </label><input type="text" name="to" /><br/><br/>
<input type="submit" name="submit" value="Submit" />
</form>
</body>

Php code

<?php
include("config.php");




if(isset($submit))
{
	
$from = $_POST['$from'];
$to = $_POST['$to'];
$submit = $_POST['$submit'];

$sql = "select * from report where dat >= '$fromtime' and dat <= '$totime' ";

$result= mysql_query($sql);

echo "<table> <table>
        <tr>
            <td>
                Date</td>
            <td>
                S.No</td>
            <td>
                Circuit Name</td>
            <td>
                Section</td>
            <td>
                Time-IN</td>
            <td>
                Time-OUT</td>
            <td>
                Nature of Failure</td>
            <td>
                Cause of Failure</td>
            <td>
                Attended By</td>
            <td>
                Remark</td>
            <td>
                Failure Duration</td>
            <td>
                Repercussions</td>
        </tr>" ;
		
		while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
		{
			
		echo "<tr><td> {$row['dat']}</td> <td> {$row['sno']}</td> <td> {$row['name']}</td> <td> {$row['section']}</td> <td> {$row['timein']}</td> <td> {$row['timeout']}</td> <td> {$row['nature']}</td> <td> {$row['cause']}</td> <td> {$row['attended']}</td> <td> {$row['remark']}</td> <td> {$row['duration']}</td> <td> {$row['repercussion']}</td> </tr> <br/> " ;
		
		
		}
		
		
		echo "</table>" ;

It not working, plz help me....

3
Contributors
6
Replies
15
Views
6 Years
Discussion Span
Last Post by diafol
0

Instead of this

if(isset($submit))
{
 
$from = $_POST['$from'];
$to = $_POST['$to'];
$submit = $_POST['$submit'];
 
$sql = "select * from report where dat >= '$fromtime' and dat <= '$totime' ";

Try this...

if(isset($_POST['submit']))
{
 
$from = $_POST['from'];
$to = $_POST['to'];
 
$sql = "select * from report where dat >= '$from' and dat <= '$to'";

See what happens, if you still get errors, show me what kinda error it is.

0

Instead of this

if(isset($submit))
{
 
$from = $_POST['$from'];
$to = $_POST['$to'];
$submit = $_POST['$submit'];
 
$sql = "select * from report where dat >= '$fromtime' and dat <= '$totime' ";

Try this...

if(isset($_POST['submit']))
{
 
$from = $_POST['from'];
$to = $_POST['to'];
 
$sql = "select * from report where dat >= '$from' and dat <= '$to'";

See what happens, if you still get errors, show me what kinda error it is.

I try it, it get error again,

<?php 
$from = $_POST['from'];
$to = $_POST['to'];

if(isset($submit))
{
$sql = "select * from report where dat >= '$fromtime' and dat <= '$totime' ";

}
Notice: Undefined index: $from  on line 15

Notice: Undefined index: $to   on line 16
0
$from = $_POST['from'];
$to = $_POST['to'];
 
if(isset($submit))
{
$sql = "select * from report where dat >= '$from' and dat <= '$to' ";
}
0

Try ardav's example...

Edited by TechySafi: n/a

0
$from = $_POST['from'];
$to = $_POST['to'];
 
if(isset($submit))
{
$sql = "select * from report where dat >= '$from' and dat <= '$to' ";
}

Hi everybody,

I clear my error, thanks to all :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.