Jump to content

if 'submit' do something is not working


funbinod
 Share

Recommended Posts

i'm trying to get make query relating to the date selection. and if no date is selected, i want to make default query without date selection.

for this i tried this ----

// above this there is a form with two input fields for from date and to date selection with a submit buttom. action is $_SERVER['PHP_SELF']if (!isset($_POST['sort'])) {     // 'sort' is the submit button name$query = "SELECT * FROM tran WHERE ssn!=0 ORDER BY date";} else {	$fdate == $_POST['fdate']; // from date	$tdate == $_POST['tdate']; // to date$query = "SELECT * FROM tran WHERE ssn!=0 AND date BETWEEN '$fdate' AND '$tdate' ORDER BY date";}

but this is not working...

 

any suggestion!!!?????

Link to comment
Share on other sites

single = is also not working.

if (!isset($_POST['sort'])) {$query = "SELECT * FROM tran WHERE ssn!=0 ORDER BY date";} else {$fdate = $_REQUEST['fdate'];$tdate = $_REQUEST['tdate'];$query = "SELECT * FROM tran WHERE ssn!=0 AND date BETWEEN '$fdate' AND '$tdate' ORDER BY date";}

it returns the query on if statement. but even after selecting the date it is the query from if statement (or simply the if, else statement is not working)..

Link to comment
Share on other sites

Check what does $_POST['sort'] returns. Use var_dump()

Link to comment
Share on other sites

there is no reason not to believe u. i'm nothing in comparison to a php tycoon like u. i was just asking for other possible reasons for it.

 

and now i found it. shame on me. i just forgot to place method="post" into the form.

 

thank u for ur company.

Edited by funbinod
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...